Search code examples
javaandroidandroid-layoutactionbarsherlock

action bar sherlock in preference menu


I have a preference menu and i want it to be consistent with the app, so there must be an action bar in top like in the rest of the activities.

i tried it like this

public class Preferencemenu extends PreferenceActivity implements
    OnSharedPreferenceChangeListener {
 .......


 class menuinflater extends BaseActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
         actionbar = getSupportActionBar();
          inflater = getSupportMenuInflater();


    }
}

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    dbHelper = new DataBaseHelper(getApplicationContext());

    Context ctx = getApplicationContext();
    TrainApplication ta = (TrainApplication) getApplication();

    actionbar.setDisplayHomeAsUpEnabled(true);
    actionbar.setHomeButtonEnabled(true);
    menuinflater menu = new menuinflater();
 .....

But ofcourse this doesn't work.

Any ideas?


Solution

  • You need to extend from SherlockPreferenceActivity.