I created an app that supports both phone and tablet version so i use the android-support-v4.jar library.
My activity extends the ListFragment and I tried to override the onCreateOptionsMenu(Menu menu, MenuInflater inflater), as in the following link: http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentMenuSupport.html
I previously called setHasOptionsMenu.
Unfortunately, it seems that I cannot override onCreateOptionsMenu().
This is the error message:
The method onCreateOptionsMenu(Menu menu, MenuInflater inflater) of type MyFragment must override or implements a supertype method.
And I did that with:
Public class MyFragment extends ListFragment
I had the same problem and this what I did to use onCreateOptionsMenu of Fragment. Override the onCreate method of the Fragment and make sure that you use setHasOptionsMenu method with parameter value "true" to let the system know Fragment will use OptionsMenu.
Then override onCreateOptionsMenu to inflate your menu xml file (here in this example I inflated fragmentmenu.xml
Make sure the imports are from the compatibility library and not from the SDK itself.
Try this, actually IDE got confused bw native menu import and Sherlock import..so if we specify it clearly then it will be resolved..
i used i used com.actionbarsherlock.view.Menu - maybe it has changed since?