I want to clarify that I talk about a navigation drawer menu and not an action button icon.
I need to change an menu icon programmatically. For this I done next:
private Menu menu;
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
this.menu = menu;
getMenuInflater().inflate(R.menu.navigation_menu, menu);
return super.onCreateOptionsMenu(menu);
}
.... and I try to change icon item with :
menu.getItem(6).setIcon(getResources().getDrawable(R.mipmap.ic_flash_on_black_24dp));
Unfortunately the item remain unchanged. Can help me to solve problem please?
I have observed that getDrawable is deprecated but no ideea how to use the new one.