Sherlock Actionbar invalidateOptionsMenu()

后端 未结 1 1116
心在旅途
心在旅途 2021-01-18 07:38

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, wit

相关标签:
1条回答
  • 2021-01-18 07:50

    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.

    Try:

    mActivity.runOnUiThread(new Runnable(){
      @Override
      public void run(){
        mActivity.supportInvalidateOptionsMenu();
      }
    });
    
    0 讨论(0)
提交回复
热议问题