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

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -