I am developing an android application in which I have created two buttons (Button1 and Button2).On click of Button1, a navigation drawer activity will open. I am succeed in doing all so. But I want that whenever the user clicks on Button2 another navigation drawer activity with different menu items in it will be shown up. Is it possible to create multiple navigation drawer activities in android? Every kind of help is appreciated.
Asked
Active
Viewed 4,173 times
0
-
http://v4all123.blogspot.in/2016/03/simple-example-of-navigation-view-on.html – Naveen Tamrakar Jun 30 '17 at 06:44
2 Answers
3
If you are using a NavigationView , you can create two menu , one for Button1 an other for Button2. Then you use NavigationView.inflateMenu(R.menu.the_relevant_menu)
when you click on the buttons to change the content of navigation view programmatically.
Hope this helps. Sorry for my english.

Cochi
- 2,199
- 2
- 12
- 15
0
Yes, You can create multiple in different activity but you can create only two navigation in a activity.
Add
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include layout="@layout/home_content"></include>
<FrameLayout
android:id="@+id/navigation_drawer"
android:layout_width="260dp"
android:layout_height="match_parent"
android:layout_gravity="left"
app:layout="@layout/nav_drawer"
tools:layout="@layout/nav_drawer" />
</android.support.v4.widget.DrawerLayout>

Gautam Singh
- 37
- 4