Android: Set menu item icon before onCreateOptionsMenu called -
the regular way change programmatically menu item icon save reference menu after oncreateoptionsmenu() called:
private menu moptionsmenu; @override public boolean oncreateoptionsmenu(menu menu) { moptionsmenu = menu; getmenuinflater().inflate(r.menu.menu_main, menu); return true; } and access like: moptionsmenu.finditem(r.id.action_something).seticon(r.mipmap.new_icon);
my question how set new icon before oncreateoptionsmenu() called - don't have reference menu?
thanks,
i don't think there way reference menu before oncreateoptionsmenu(). why want set icon before oncreateoptionsmenu?
apologies posting answer need 50 points able comment.
Comments
Post a Comment