Search code examples
androideclipseactionbarsherlock

Android sherlock library invalid option menu issue


I've got this problem several times, and every times it solves by itself. I don't know how neither why I have this problem.

Last time, I've just clean the workspace (Build Auto after) and try to run the android application.

Here the code that trigger the error.

    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
            R.drawable.ic_drawer, R.string.drawer_open,
            R.string.drawer_close) {

        /** Called when drawer is closed */
        public void onDrawerClosed(View view) {
            getSupportActionBar().setTitle(mTitle);
            invalidateOptionsMenu();
        }

        /** Called when a drawer is opened */
        public void onDrawerOpened(View drawerView) {
            getSupportActionBar().setTitle("Menu");
            invalidateOptionsMenu();
        }
    };

I've already try to clear the Link Markers, which works but just until I clean the project again.

Thanks


Solution

  • Didn't found what was the cause of this problem, but it solved by itself.

    Edit: The bug came back, then I changed for this method "supportInvalidateOptionsMenu()"

    Now it's working perfectly :)