The problem that I faced is I cannot retrieve the binding id of my menu items.
HomeFragment ->includes(HomeActivity) ->includes(BottomNavigation)
//bottom navigation
fun getBottomNavigation(){
val bottomNavigation = binding!!.includeBottomNavigation.bottomNavigation
bottomNavigation.itemIconTintList = null
bottomNavigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelected)
}
private val mOnNavigationItemSelected = BottomNavigationView.OnNavigationItemSelectedListener{ menuItem ->
when (menuItem.itemId) {
R.id.navigation_home -> {
//the issue what is, I want to use binding. navigation_home but it doesnot occur
return@OnNavigationItemSelectedListener true
}
R.id.navigation_chapter -> {
return@OnNavigationItemSelectedListener true
}
R.id.navigation_store -> {
return@OnNavigationItemSelectedListener true
}
}
false
}
//menu items
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
<item
android:id="@+id/navigation_home"
android:enabled="true"
android:icon="@drawable/ic_home"
android:title="" />
<item
android:id="@+id/navigation_notification"
android:enabled="true"
android:icon="@drawable/ic_notification"
android:title="" />
</menu>