” I solved the problem by adding the declaration of the activity into Manifest. “
I want to start an activity when the optionmenu button is pressed.
When i press the button the application crash.
The application crash when i call “openAbout()” . Thanks to everyone for helping.
Here is my code:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add(0,0,1,R.string.menuAbout);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
default:
Intent i = new Intent(this, About.class);
this.startActivity(i);
return true;
}
}
public void openAbout(){
Intent i = new Intent();
i.setClass(this, About.class);
startActivity(i);
}
Before Starting , plz every time when you have a question , plz add the stack trace so others can understand the type of the problem ,
First , check if your activity is already declared on your manifest file ,
Second , try to change the instanciation of your intent to be like this :