Android problem with opening a second activity and fails to launch
- by Capsud
Hi there,
Bear with me as i'm just learning about Android.
What i'm trying to do is to open an Activity when i click on a button.
This is my code in my main activity
public class MainPage extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button restaurants = (Button) findViewById(R.id.widget88);
restaurants.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), AZRestaurants.class);
startActivityForResult(myIntent, 0);
}
});
//Button location = (Button) findViewById(R.id.location);
//location.setOnClickListener(new View.OnClickListener() {
//public void onClick(View view) {
// Intent myIntent = new Intent(view.getContext(), Location.class);
// startActivity(myIntent);
//}
// });
}
The program launches no problem when i just implement the first button (restuarant).
But when i try to implement the button that i have commented out it fails to launch.
and yes i have added the activity to the manifest file.
Can anyone help me please?
Thanks.