Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

onPrepareOptionsMenu in Fragment not being called as of AppCompat v22 (API 10)

We have an app that uses AppCompatActivity with multiple fragments, each of which contribute to the options menu. (i.e. the fragments override onCreateOptionsMenu and insert their own menu items)

The fragments also override onPrepareOptionsMenu, in order to conditionally enable/disable certain menu items based on the state of the app.

Prior to the updated version (22) of appcompat, the onPrepareOptionsMenu function was called for each fragment, and everything was working correctly. But now, it's no longer being called.

This behavior is only present in API 10. In newer APIs it works correctly. Any ideas?

like image 829
Dmitry Brant Avatar asked Oct 19 '22 11:10

Dmitry Brant


1 Answers

With a little digging, I found this: https://code.google.com/p/android/issues/detail?id=170630

Let's hope this is resolved in the next release of appcompat!

like image 130
Dmitry Brant Avatar answered Nov 03 '22 01:11

Dmitry Brant