We have a menu consisting of a single checkable item. Rearrange the scattered lines of code to make our callback work properly.
Menus: Options, Popup
Handling a CheckBox
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
R.id.detailed -> {
}
showDetailedInfo = !showDetailedInfo
true
override fun onMenuItemSelected(menuItem: MenuItem): Boolean = when (menuItem.itemId) {
else -> false
menuItem.isChecked = showDetailedInfo
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.