I want a menu when I click the menu button on an android device and I have created a method and other stuff in this. It was on another project bt I took the code and adapted it into my new project! earlier it worked fine bt, now the activity force closes! I could'nt find the error! please help me!
the method ---->
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
// TODO Auto-generated method stub
switch (item.getItemId()) {
case R.id.about:
Intent contextmenu = new Intent("com.sliit.droidman.main.About");
startActivity(contextmenu);
break;
case R.id.exit:
finish();
break;
}
return false;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
MenuInflater droidmenu = getMenuInflater();
droidmenu.inflate(R.menu.contextmenu, menu);
return true;
}
The logcat log, from where the error occures!
07-05 17:11:43.419: W/dalvikvm(4546): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
07-05 17:11:43.448: E/AndroidRuntime(4546): FATAL EXCEPTION: main
07-05 17:11:43.448: E/AndroidRuntime(4546): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.sliit.droidman.main.About }
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1545)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1416)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.app.Activity.startActivityForResult(Activity.java:3351)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.app.Activity.startActivityForResult(Activity.java:3312)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.app.Activity.startActivity(Activity.java:3522)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.app.Activity.startActivity(Activity.java:3490)
07-05 17:11:43.448: E/AndroidRuntime(4546): at com.sliit.droidman.main.MainActivity.onMenuItemSelected(MainActivity.java:130)
07-05 17:11:43.448: E/AndroidRuntime(4546): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:958)
07-05 17:11:43.448: E/AndroidRuntime(4546): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
07-05 17:11:43.448: E/AndroidRuntime(4546): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
07-05 17:11:43.448: E/AndroidRuntime(4546): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
07-05 17:11:43.448: E/AndroidRuntime(4546): at com.android.internal.view.menu.ListMenuPresenter.onItemClick(ListMenuPresenter.java:166)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.widget.AdapterView.performItemClick(AdapterView.java:298)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.widget.AbsListView.performItemClick(AbsListView.java:1086)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2855)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.widget.AbsListView$1.run(AbsListView.java:3529)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.os.Handler.handleCallback(Handler.java:615)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.os.Handler.dispatchMessage(Handler.java:92)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.os.Looper.loop(Looper.java:137)
07-05 17:11:43.448: E/AndroidRuntime(4546): at android.app.ActivityThread.main(ActivityThread.java:4745)
07-05 17:11:43.448: E/AndroidRuntime(4546): at java.lang.reflect.Method.invokeNative(Native Method)
07-05 17:11:43.448: E/AndroidRuntime(4546): at java.lang.reflect.Method.invoke(Method.java:511)
07-05 17:11:43.448: E/AndroidRuntime(4546): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
07-05 17:11:43.448: E/AndroidRuntime(4546): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-05 17:11:43.448: E/AndroidRuntime(4546): at dalvik.system.NativeStart.main(Native Method)