I want to add click event when I click on one of the item in navigation drawer, I have used onNavigationItemSelected method but it's not working, Any help?
override fun onNavigationItemSelected(item: MenuItem): Boolean {
TODO("Not yet implemented")
val id = item.itemId
if (id == R.id.nav_signout) {
Toast.makeText(this, "Sign out", Toast.LENGTH_SHORT).show()
}
return true
}
drawer.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">
<group android:checkableBehavior="single">
<item android:title="Authentication">
<menu android:checkableBehavior="all">
<item
android:id="@+id/nav_signout"
android:icon="@drawable/ic_menu_gallery"
android:title="Sign out" />
</menu>
</item>
</group>
</menu>