Search code examples
androidandroid-actionbarandroid-actionbar-compat

Cannot override the final method from ActionBarActivity


I'm in the process of migrating from ActionBarSherlock to ActionBarCompat library that was introduced in Google IO 2013 (I do this so I can use ActionBarDrawerToggle).

I have already sorted out all the necessary dependencies (AppCompat, latest support library...), fixed all the imports but now when I try to use ActionBarActivity's onMenuItemSelected I get an error.

@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
    ...
}

Error:

Cannot override the final method from ActionBarActivity

The original method from ActionBarActivity (inherited from FragmentActivity) is final. When I used ABS, this was working, now I can't override the method.

(MenuItem is of class android.view.MenuItem and not the compat version...)

Am I missing something ?


Solution

  • Instead of using onMenuItemSelected I used onOptionsItemSelected and the code compiled okay.

    Can it be that onMenuItemSelected appears in the docs but not in the code ?