Android Kotlin - Can't call onNavigationItemSelected method
You can give your NavigationView
an ID in your layout file:
<android.support.design.widget.NavigationView
android:id="@+id/navigationView"
... >
</android.support.design.widget.NavigationView>
And then add a listener to it in your UserActivity
:
navigationView.setNavigationItemSelectedListener {
when (it.itemId) {
R.id.nav_home -> {
// handle click
true
}
else -> false
}
}