I need an example or a tutorial
on how to add menu items with action bar sherlock
When I use the simple menu
with the imports
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
when I call
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.settings_menu, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.goToSettings:
startActivity(new Intent(this, SetPreference.class));
return true;
default:
return super.onOptionsItemSelected(item);
}
}
then I get the Cannot override the final method from SherlockActivity error.
Best Answer
You have to use
Menu
,MenuInflater
andMenuItem
classes fromcom.actionbarsherlock.view
package:BTW,
ActionBarSherlock
contains a lot of samples.