Could anyone try to help me with this ? <https://k...
# android
j
Could anyone try to help me with this ? https://kotlinlang.slack.com/archives/C09222272/p1658483494439749 I couldn't find an issue on android issue tracker or in the jetbrains issue tracker...
n
Never used that, but according to documentation looks like you must cast activity to
MenuHost
Copy code
val menuHost: MenuHost = requireActivity()
  
    // Add menu items without using the Fragment Menu APIs
    // Note how we can tie the MenuProvider to the viewLifecycleOwner
    // and an optional Lifecycle.State (here, RESUMED) to indicate when
    // the menu should be visible
    menuHost.addMenuProvider(object : MenuProvider {
....
}
And use ktx dependency
Copy code
implementation "androidx.activity:activity-ktx:$activity_version"
j
I will try casting it, but it is just odd as the code compiles and runs. Just the IDE that is broken.