Home > Back-end >  How to use hasOptionsMenu() in Android?
How to use hasOptionsMenu() in Android?

Time:12-08

My code shows an error with the text: "Fragment.hasOptionsMenu can only be called from within the same library group prefix (referenced groupId=androidx.fragment with prefix androidx from groupId=Personal Pocket Dictionary"

I've imported the library and have the right dependency "implementation "androidx.fragment:fragment-ktx:$fragment_version"" so none of that is the issue.

Not sure how to fix this

CodePudding user response:

Use setHasOptionsMenu(true) instead.

  • Related