Questions tagged [preferenceactivity]

PreferenceActivity in Android is a base class for an activity to show a hierarchy of preferences to the user

680 questions
33
votes
4 answers

Custom PreferenceCategory Headings

I have a simple preference screen defined like this
Josh
  • 16,286
  • 25
  • 113
  • 158
29
votes
2 answers

Why won't Fragment retain state when screen is rotated?

I've been having some trouble getting some custom DialogPreference subclasses inside a PreferenceFragment to remain visible when the screen is rotated. I don't experience this problem when using a PreferenceActivity, so I don't know whether it's an…
25
votes
1 answer

Action Bar Home Button not functional with nested PreferenceScreen

I found a workaround to actually enable the ActionBar home button on the nested PreferenceScreen... however it doesn't call OnOptionsItemSelected in my PreferenceActivity. Anyone know a way to actually use the home button on a nested…
25
votes
4 answers

Skip the headers in PreferenceActivity when there's only one header

I added preference-headers to my app so that the preference screen would not look broken on Honeycomb and tablet sized ICS. However, I only have one header at the moment so you have to click through a header screen with only one entry on phone sized…
Freaky Dug
  • 995
  • 11
  • 11
24
votes
4 answers

getActionBar() returns null in PreferenceActivity (AppCompat-v7 21)

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 my app crashes at java.lang.NullPointerException: Attempt to invoke virtual method 'void…
Olegas Gončarovas
  • 1,521
  • 1
  • 11
  • 16
23
votes
5 answers

MultiSelectListPreference example

I am having a hard time trying to find a good example of the MultiSelectListPreference provided in the Android API. I have seen many references to this blog, and tho this is the end result I desire, I don't want to create a class for each…
mohbandy
  • 281
  • 1
  • 2
  • 8
22
votes
8 answers

Preference Activity on Preference Click Listener

I am building a Preference Activity where most of the preferences in the list will be executing code and not modifying a SharedPreference directly. My preferences.xml file looks like this.
BarryBostwick
  • 919
  • 2
  • 12
  • 21
21
votes
2 answers

Android - DataBinding with Preference activity

I set up the data binding in xml but when i go to the preference activity to actually set up the binding i cant. The file where the data binding xml is in is called preference.xml so i assume there should be a generated class called…
j2emanue
  • 60,549
  • 65
  • 286
  • 456
21
votes
3 answers

Setting default values of multiple SharedPreferences instances/files

Suppose that I have an application which saves preferences onto two files, preferences1.xml and preferences2.xml. Then, I can retrieve references to the corresponding objects with the following code: SharedPreferences sharedPrefs1 =…
20
votes
6 answers

setDisplayHomeAsUpEnabled() not working in PreferenceActivity

I have a SettingsActivity which extends PreferenceActivity to show settings in my app. There is a back arrow, but it is not working. Here's SettingsActivity.java file's code: public class SettingsActivity extends PreferenceActivity implements…
19
votes
7 answers

How to add ToolBar in PreferenceActivity?

I want to add ToolBar in PreferenceActivity in my android application. I wrote the following code. public class SettingsActivity extends PreferenceActivity { SendSMS sms; protected void onCreate(Bundle savedInstanceState) { …
Tek Raj
  • 323
  • 1
  • 3
  • 8
18
votes
8 answers

Keep the actionbar displayed in when changing PreferenceScreen

I'm trying to display a actionbar in my preference screen. In order to do so I added the following code in my SettingActivity public class PreferencesActivity extends ActionBarActivity { @Override protected void onCreate(Bundle…
18
votes
5 answers

Android- deprecated method warning regarding PreferenceActivity

When I attempt to follow Android's Developer guides and tutorials for creating a Settings Activity using Preferences, I receive warnings such as: "The method addPreferencesFromResource(int) from the type PreferenceActivity is deprecated" for both of…
17
votes
3 answers

android - How to set custom layout for PreferenceActivity in Android 3.0?

I am developing app with minSdkVersion="11", that is app for tablets and Android 4.0 and newer. I have scrutinized internet on this topic, but have not found much. To implement custom layout for previous versions of Android SDK we just have to…
morphium
  • 686
  • 1
  • 6
  • 13
17
votes
1 answer

DialogFragment in PreferenceActivity

I have defined dialogfragments (because Android documentation says that it is better and indeed it is) but now I want to use it in PreferenceActivity. The problem is that I cannot use getSupportFragmentManager() there and I cannot use…
Matroska
  • 6,885
  • 14
  • 63
  • 99
1
2
3
45 46