Closed annajeanine closed 2 years ago
The turbo-android
library doesn't handle menu items in any direct way, but it's totally supported in your own app and custom code. You'll want to handle it similar to this:
toolbarForNavigation()?.apply {
inflateMenu(R.menu.web)
setOnMenuItemClickListener {
when (it.itemId) {
R.id.logoutButton -> {
// ...
true
}
else -> false
}
}
}
This is a more modern approach using the Toolbar
APIs directly than overriding onOptionsItemSelected()
.
@jayohms Thank you! Works like a charm :)
I have extended the
res/menu/web
with a logout option:In the
WebFragment
I want to handle the logout, but the action is not being called. I'm trying this by doing:I have tried solving this by checking this StackOverflow topic, but no luck. Therefor, I am wondering if it is even possible with this package.