I am trying to use 3 diferent side menus and for that 3 layouts one for each and a menu for each layout, but only the layout in the activity_main is working when i run the app.the other two when i login to that menu it doesnt open the layout and the app closes or goes back to the login page. Do I need to have the layout to every menu in the activity_main or I am doing something wrong?
I tested every menu in the activity_main and every one works fine in this layout. I am trying to call by id https://github.com/AlfredoAguiar/Cm_pro
`binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(R.layout.activity_main_admin)
setSupportActionBar(binding.appBarMain.toolbar)
val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout_admin)`
layout tht works: activiy_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.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
android:id="@+id/app_bar_main"
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:itemIconTint="@color/my_yellow"
app:itemRippleColor="@color/my_yellow"
app:itemShapeFillColor="@color/my_blue"
app:itemTextColor="@color/my_yellow"
app:menu="@menu/activity_main_drawer" />
</androidx.drawerlayout.widget.DrawerLayout>
activity_main_admin.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.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_admin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
android:id="@+id/app_bar_main"
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:itemIconTint="@color/my_yellow"
app:itemRippleColor="@color/my_yellow"
app:itemShapeFillColor="@color/my_blue"
app:itemTextColor="@color/my_yellow"
app:menu="@menu/activity_main_drawer_admin2" />
</androidx.drawerlayout.widget.DrawerLayout>