Created
July 11, 2019 02:21
-
-
Save madindo/9e9f308ef2f6b70d2eb7810fd68fa1e6 to your computer and use it in GitHub Desktop.
Android Material Design Popup Menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onCreateOptionsMenu(Menu menu) { | |
getMenuInflater().inflate(R.menu.menu_main, menu); | |
return true; | |
} | |
@Override | |
public boolean onOptionsItemSelected(MenuItem item) { | |
int id = item.getItemId(); | |
if (id == R.id.item1_id) { | |
Toast.makeText(getApplicationContext(), "Item 1 is selected", Toast.LENGTH_SHORT).show(); | |
} else if (id == R.id.item2_id) { | |
Toast.makeText(getApplicationContext(), "Item 2 is selected", Toast.LENGTH_SHORT).show(); | |
} else if (id == R.id.item3_id) { | |
Toast.makeText(getApplicationContext(), "Item 3 is selected", Toast.LENGTH_SHORT).show(); | |
} | |
return super.onOptionsItemSelected(item); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment