Sherlock Actionbar invalidateOptionsMenu()

I’m with a big error here.
I’m trying to change the actionbar menus with the supportInvalidateOptionsMenu(); but when the function is executed, the application closes, without errors.

The strange thing is that everything works normally on my Galaxy Nexus (4.2.2), but does not work in my friend’s mobile (android 4.0.3) nor in my emulator with android 2.1

  • Where are the Android icon drawables within the SDK?
  • Glide can't load file from internal storage
  • Android Throwing OutOfMemoryError “Failed to allocate a 164 byte allocation with 44 free bytes and 44B until OOM” (recursive case)
  • Android Studio: Installation failed since APK was not signed
  • Is there a limit for the number of files in a directory on an SD card?
  • Android deep link working only in some websites
  • Here is my code:

    protected void onCreate(Bundle savedInstanceState) {
    actionbar = getSupportActionBar();
    myWebView = (WebView) findViewById(;
    myWebView.addJavascriptInterface(new WebAppInterface(this), "Android");
    public class WebAppInterface {
    SherlockActivity mActivity;
    WebAppInterface(SherlockActivity c) {mActivity = c;}  
    public void setrefreshon() {showRefresh = true; mActivity.supportInvalidateOptionsMenu();}

    Can someone help me? :/

    Related posts:

    What theme attributes do I need to override to change the blue highlight color of my dialogs?
    Android Emulator, cover screen with palm to dim
    Error:Execution failed for task ':app:processDebugResources'. > at index 4
    Android E/Parcelīš• Class not found when unmarshalling (only on Samsung Tab3)
    NestedScrollview wont start from top
    issue with removing polyline google map v2 android
  • Android findViewById in DialogFragment
  • Android : Check whether the phone is dual SIM
  • Gradle ADT 0.4 error: android.buildToolsVersion is missing
  • how can i see how much memory my app is using out of its VM budget?
  • Rendering in cocos2d-x using values from a math function
  • Defining a percentage width for a LinearLayout?
  • One Solution collect form web for “Sherlock Actionbar invalidateOptionsMenu()”

    This is most likely a threading issue. You should be seeing logged errors about UI access outside of main thread. Perhaps you’re filtering them out? Look at the full log, not just the log for your package.

    From the Building Web Apps in Webview:

    Note: The object that is bound to your JavaScript runs in another
    thread and not in the thread in which it was constructed.


    mActivity.runOnUiThread(new Runnable(){
      public void run(){
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.