Reputation: 1
i have implemented menu in android with two menu items "edit" and "delete". I can see my Menu Item but when i click either of them nothing happens. here is my implementation.
public boolean onOptionItemSelected(MenuItem item)
{
switch(item.getItemId())
{
case R.id.edit:
Toast.makeText(MainActivity.this, "edit clicked", 5).show();
return true;
case R.id.delete:
Toast.makeText(MainActivity.this, "delete clicked", 5).show();
return true;
default:
return super.onOptionsItemSelected(item);
} //end switch
}//end method
edit and delete are the id's of item in menu.xml. i will appreciate any help...
Upvotes: 0
Views: 391
Reputation: 56
Change the method name to onOptionsItemSelected (with an s after Option).
Upvotes: 2