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
Post a Comment