Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionBarSherlock getMenuInflater issues

I have recently taken the ABS4.0 dive. However, I appear to be having an issue using the MenuInflater.

When using the getMenuInflater() method, I receive an error message stating: "Type mismatch: cannot convert from android.view.MenuInflater to com.actionbarsherlock.view.MenuInflater"

So, it looks like the definition is picking up the ABS version of menu inflater but the getMenuInflater() method is returning the base Android version. Code below:

@Override public boolean onCreateOptionsMenu(Menu menu) {     MenuInflater inflater = getMenuInflater();     inflater.inflate(R.menu.menu, menu);     return super.onCreateOptionsMenu(menu); } 

Anyone able to tell me what I'm doing wrong here? Would be much appreciated!

like image 460
Nedlinin Avatar asked Apr 03 '12 17:04

Nedlinin


1 Answers

Try changing getMenuInflater() to getSupportMenuInflater()

like image 167
SeanPONeil Avatar answered Sep 21 '22 18:09

SeanPONeil