android - Handling onOptionsItemSelected for both Navigation drawer and Action buttons -
i have navigation drawer in 1 of activities in android. have added couple of action buttons , action overflow action bar in same activity. now, problem handling select event navigation drawer items, action buttons, , action overflow menu. currently, setoptionsitemselected
looks this:
@override public boolean onoptionsitemselected(menuitem item) { if (mdrawertoggle.onoptionsitemselected(item)) { return true; } return super.onoptionsitemselected(item); }
how can make work navigation item clicks, action button clicks, , action overflow menu clicks? appreciated.
if ur xml file contains listview shown below u need findviewbyid listview in navigation drawer activity , set setitemselectlistener... don't know how have u implemented , designed ur navigation drawer ..so if doesnt please share ur code.. there no relationship , dependency between actionbar , navigationdrawer
<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/drawerlayout"> <fragment android:name="com.example.juju.main" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/maincontent"></fragment> <listview android:divider="@null" android:background="#202020" android:layout_width="240dp" android:layout_height="match_parent" android:id="@+id/drawerlist" android:layout_gravity="left"> </listview> </android.support.v4.widget.drawerlayout>
what below code doing enabling navigationdrawer open actionbar title.. handling items in actionbar , in overflow u have implement via onoptionitemselected()..hope clears everything..
if (mdrawertoggle.onoptionsitemselected(item)) { return true; } return super.onoptionsitemselected(item);
Comments
Post a Comment