Ok, I just removed the final from the onCreateOptionsMenu() method
(both were final in FragmentActivity for some reason). This gets me
going however I am now getting a ClassCastException when trying to
inflate the menu. Here is the stack trace:
java.lang.ClassCastException:
com.android.internal.view.menu.MenuBuilder
at
android.support.v4.view.MenuInflater.inflate(MenuInflater.java:88)
at
com.tvshowfavs.android.ui.phone.SeriesInfoActivity.onCreateOptionsMenu(SeriesInfoActivity.java:
33)
at android.app.Activity.onCreatePanelMenu(Activity.java:2158)
at
com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:
328)
at
com.android.internal.policy.impl.PhoneWindow.onKeyDownPanel(PhoneWindow.java:
573)
at
com.android.internal.policy.impl.PhoneWindow.onKeyDown(PhoneWindow.java:
1215)
at com.android.internal.policy.impl.PhoneWindow
$DecorView.dispatchKeyEvent(PhoneWindow.java:1691)
at
android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:
2561)
at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:
2536)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1868)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
599)
at dalvik.system.NativeStart.main(Native Method)
The menu being passed in is a
com.android.internal.view.menu.MenuBuilder menu rather than a
com.actionbarsherlock.internal.view.menu.MenuBuilder menu. Any
suggestions?
> Change your Menu import from android.view.Menu to
> android.support.v4.view.Menu and the override will work.
>
> The method is marked as final in FragmentActivity to prevent people from
> overriding the incorrect version.
>
> ---
> Jake Whartonhttp://
about.me/jakewharton