I wanted to enter a settings page when I hold down the home button on the bottom navigation bar. I looked for how to get the id of a button in the bottom navigation but couldn't find anything.
Do you know if I can get a button from this bar?
Thanks !
Try this code:
binding.bottomNav.menu.forEach {
if (it.itemId == R.id.home) {
binding.bottomNav.findViewById<View>(it.itemId).setOnLongClickListener {
// your action
true
}
}
}
It iterates through all the menu items of the BottomNavView
and sets LongClickListener
for the desired menu item