@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_item_save: // do something when "Save" menu item is clicked return true; case R.id.menu_item_delete: // do something when "Delete" menu item is clicked return true; default: return super.onOptionsItemSelected(item); } }In this example, we are using the getItemId() method to determine which menu item was clicked. The android.view.MenuItem class is part of the Android Framework (android.view package).