I have implemented DoneBar (two buttons in actionbar) in PreferenceActivity
as provided in v20 sdk samples, but after updating SDK and AppCompat to version 21 m
as xXx requested I am providing example how I done:
public class SettingsActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Display the fragment as the main content.
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new SettingsFragment())
.commit();
// use action bar here
ActionBar actionBar = getSupportActionBar();
}
public static class SettingsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle paramBundle) {
super.onCreate(paramBundle);
addPreferencesFromResource(R.xml.pref_settings);
}
}
}