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

Popular posts from this blog

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -