Oncreateoptionsmenu not called fragment

Oncreateoptionsmenu not called fragment

By: one for one Date of post: 14.06.2017

I'm trying to override the options menu in my android. The onCreateOptionsMenu method gets called when using an emulator with Android 4.

oncreateoptionsmenu not called fragment

My main Activity extends ActionBarActivity, and I make the required setHasOptionsMenu true call in the onCreate of my Fragment. I've tried both ActionBarCompat and ActionBarSherlock, and I have the same exact issue with both libraries.

android - onCreateOptionsMenu() is not getting called on FragmentActivity - Stack Overflow

I'm not sure however I'll try to help you. With ABS, I answered on a "same" behaviour and it worked well. Then, with AppCompatyou have to call super method after all your stuff as follows:.

oncreateoptionsmenu not called fragment

You have a great explaination and example on this answer. You should also check your imports. However it's maybe related to your device and not with the way you do it not sure, because on 4.

oncreateoptionsmenu not called fragment

By posting your answer, you agree to the privacy policy and terms of service. Stack Oncreateoptionsmenu not called fragment Questions Developer Jobs Documentation beta Tags Users. Sign up or log in to customize your list.

Tour Start here for a quick overview of the site Help Center Detailed answers to any questions oncreateoptionsmenu not called fragment might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us.

Log In Quick ways to make money in dallas tx Up. Join the Stack Overflow Community.

Stack Overflow is a community of 7. Join them; it only takes a minute: Works on emulator, not on device Ask Question. Sachin K 2 Then, with AppCompatyou have to call super method after all your stuff as follows: Fllo 9, 5 22 Your linked answer was very helpful.

android - onCreateOptionsMenu not called in Fragment. Works on emulator, not on device - Stack Overflow

In this particular case I was running into an Exception before onCreateOptionsMenu was hit. Once that code was removed, the method was being called just fine. Still not sure why it was an issue on the 4.

android - onCreateOptionsMenu is never called - Stack Overflow

Really glad to help. Rana Ranvijay Singh 2, 2 19 I used inside onCreate and works. Sign up or log in StackExchange.

Sign up using Facebook.

Sign up using Email and Password. Post as a guest Name. Stack Overflow works best with JavaScript enabled. MathOverflow Mathematics Cross Validated stats Theoretical Computer Science Physics Chemistry Biology Computer Science Philosophy more 3. Meta Stack Exchange Stack Apps Area 51 Stack Overflow Talent.

inserted by FC2 system