android - Know which menu resource is inflated -


im application inflate different menu resources, this:

public boolean oncreateoptionsmenu(menu menu) {     _menu = menu;     if (/* condition */) {         getmenuinflater().inflate(r.menu.menu_activity_detail, _menu);     } else {         getmenuinflater().inflate(r.menu.menu_empty, _menu);     }     return true; } 

before save menu object further reuse, inflating new menu under specific circumstances.

now question: there way know resource i've inflated @ creation of activity, without manually saving id of r.menu.menu_res?

you should not keep reference menu. why don't use invalidateoptionsmenu() method of activity? there's supportinvalidateoptionsmenu() handle appcompatactivity


Comments