I am using ActionBarSherlock and in my Preference Activity, as soon as I add the @Override onOptionsItemSelected function, I get an error.
The error -
The method onOptionsItemSelected(MenuItem) of type SettingsActivity must override or implement a supertype method
Is this wrong?
public class SettingsActivity extends PreferenceActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preference);
getActionBar().setDisplayHomeAsUpEnabled(true);
}
// Following method throws the error
@Override
public boolean onOptionsItemSelected(MenuItem item) { // <-- Error
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item); // <-- Error
}
}