android - Need Value of "sendUserActionEvent() mView == null" -


im working on part of android app should switch between activities. happens on actionbar dropdown-menu.

my problem is: don't value know activity should call (on if-statements in onclick).

heres code: onoptionsitemselected:

@override public boolean onoptionsitemselected (menuitem item){     // handle action bar item clicks here. action bar     // automatically handle clicks on home/up button, long     // specify parent activity in androidmanifest.xml.     int id = item.getitemid();      //noinspection simplifiableifstatement     if (id == r.id.home) {         toast.maketext(getapplicationcontext(), "home wurde angeklickt!!", toast.length_short); replacefragment(hf);     }     if (id == r.id.archiv) {         toast.maketext(getapplicationcontext(), "archiv wurde angeklickt!!", toast.length_short); replacefragment(af);     }      return super.onoptionsitemselected(item); } 

menu_homescreen(.xml):

<menu xmlns:android="http://schemas.android.com/apk/res/android">         <item android:id="@+id/home"             android:icon="@drawable/home"             android:title="gehe zu home" />         <item android:id="@+id/archiv"             android:icon="@drawable/archiv"             android:title="gehe zu archiv" />     </menu> 

or there way switch fragments? greetings, john


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -