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

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -