I'm trying to change an item in OptionMenu, depending on whether the activity is selected from the spinner Name is, I tried to set my status in invalidateOptionsmenu ()
inside spinner.setOnItemSelectedListener
and then onPrepareOptionsMenu
, but I get an error :
"java.lang.ClassCastException: com.android.internal.view.menu.ActionMenuItemView can not be inserted on Android.view.MenuItem"
Public The extension of main activity activity (private long project id; crate on public void (bundle saved instanestate) {super.naught (savedinstenstate); datatours = new statementdatasource (this); datasource.open (); setContentView ( R.layout.activity_main); // Setting a Spinner with Simple Kaiser Adapter ... Selected items on public zeros (adapterview ; Gt; parent, view view, integer position, long ID) {projectId = Id; // Trigger options menu to invalidate the menu (); }} @ Override Public Boolean Peripheroption Menu (Menu Menu) {Private String Phone Number = Datasource.JetphoneNumber (Project ID); // If the selected name has a phone number in the database, check that (! PhoneNumber.isEmpty ()) {// value can be blank or empty menu. Fix id (R.id.callbutton) .setVisible (true); } Else {menu.findItem (R.id.callbutton) .setVisible (wrong); } Return super. Paraphrase option menu (menu); }
No comments:
Post a Comment