Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using PreferenceActivity and ActionBarActivity

Tags:

android

Is it possible to use ActionBarActivity in conjunction with PreferenceActivity. Basically, I want to use the following code:

getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Enables the "back" arrow

The issue is PreferenceActivity doesn't contain the getSupportActionBar() method and ActionBarActivity doesn't contain any methods for managing and displaying preferences.

like image 412
William Seemann Avatar asked Sep 06 '13 05:09

William Seemann


2 Answers

If you are willing to turn your PreferenceActivity into a PreferenceFragment there is an implementation based on support-v4 Fragment:

https://github.com/kolavar/android-support-v4-preferencefragment

Im using it myself and it works just fine in conjunction to ActionBarActivity!

like image 89
Ostkontentitan Avatar answered Nov 15 '22 12:11

Ostkontentitan


ActionBarCompat the feature is not supported yet.

How to add Action Bar from support library into PreferenceActivity?

ActionBar been added in the HoneyComb can use the following code:

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
    getActionBar().setDisplayHomeAsUpEnabled(true);
like image 27
HwangTi Avatar answered Nov 15 '22 13:11

HwangTi