android - I have a MenuItem instance and I get one particular item and set its visibility to false....results in an runtime error -
null object reference android.view.menuitem.setvisible(true);
in oncreateoptionsmenu()
code is:
@override public void oncreateoptionsmenu(final menu menu, final menuinflater inflater) { mmenu = menu; inflater.inflate(r.menu.contact_list_menu, menu); }
in function hidemenu()
code is:
mmenuitem.setvisible(false);
contact_list_menu.xml
:
<menu xmlns:android="schemas.android.com/apk/res/android"> <item android:id="@+id/action_reimport" android:title="@string/reimport" android:icon="@drawable/ic_reimport_contacts" android:showasaction="always"/> </menu>
Comments
Post a Comment