The home/back icon in the actionbar has the id android.R.id.home.
How to find the application icon for nav drawer
-
15-06-2023 - |
Question
I am trying to get the id for application icon so that I know when the Navigation Drawer Icon is pressed. I know it is 16908332 because I tried logging it on
public boolean onOptionsItemSelected(MenuItem item)
03-15 20:06:39.476 .../...control.NavDrawer﹕ Menu item id: 16908332
I want to know how to get that id in code and does this id change when the app is installed on different devices?
I am trying to do this
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == 16908332){ //How do I get the icon Id?
isDrawerOpened = !isDrawerOpened;
activity.invalidateOptionsMenu();
}
return toggleIcon.onOptionsItemSelected(item);
}
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow