I new to app development and I have been working on a Flash card app. There is a main screen and the user chooses a button. On the emulator when I touch a button to go to a new activity, my app force closes.
I have added the activity in the manifest.
The second activity has its own layout (main2.xml).
My buttons look like this:
Button add = (Button) findViewById(R.id.add);
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent addIntent = new Intent(view.getContext(), Add.class);
startActivity(addIntent);
}
});
Any ideas of what’s going wrong? If more info is needed I can supply it, I’ve been stuck here for two days.
Thanks
Your activity in the manifest should look like this:
You then can start it like this:
To get more help post the manifest file and the exception you get, when the application crashes. You can see that in Eclipse’s debug perspective, in the LogCat view.