I have created a menu for my activity by writing layout and inflating it in my activity.
When i written onOptionItemSelected The Rid recieved from the event listener and that i have from R.id.menu are different eventhough i clicked on the correct menu item. It is one digit lesser than actual. so my click function is not working?
I have created a menu for my activity by writing layout and inflating it
Share
They are 2 different ID.
The id that you use to inflate the menu is R.menu.*
But the id that you use to uniquely identify your menu is R.id.*
See here for sample:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/MenuInflateFromXml.html