PreferenceActivity in Android is a base class for an activity to show a hierarchy of preferences to the user
Questions tagged [preferenceactivity]
680 questions
386
votes
6 answers
How do I get the SharedPreferences from a PreferenceActivity in Android?
I am using a PreferenceActivity to show some settings for my application. I am inflating the settings via a xml file so that my onCreate (and complete class methods) looks like this:
public class FooActivity extends PreferenceActivity {
…

Dave
- 3,983
- 3
- 17
- 8
128
votes
8 answers
How to add Action Bar from support library into PreferenceActivity?
Action Bar compatibility has been added into support library, revision 18. It now has ActionBarActivity class for creating activities with Action Bar on older versions of Android.
Is there any way to add Action Bar from support library into…

Roman
- 5,358
- 9
- 34
- 43
84
votes
8 answers
No ActionBar in PreferenceActivity after upgrade to Support Library v21
After I upgraded to the Support Library v21 my ActionBar in my PreferenceActivity is gone.
Did I miss some attributes in my theme to activate it again? I had some similar trouble with a black ActionBar.
I also tried to add it a little hackish by…

rekire
- 47,260
- 30
- 167
- 264
77
votes
2 answers
How to detect if changes were made in the preferences?
I have a class that extends PreferenceActivity and shows the preference screen of my app. Is it possible to check if any changes were made to the preferences?
This…

mixkat
- 3,883
- 10
- 40
- 58
69
votes
12 answers
Android: Start Activity from preferences.xml
I would like to start an Activity from a default preferences.xml, with < intent > tag. The Activities are well tested, the problem is not with that. (I'm extending PreferenceActivity in my app, so the preferences.xml is "comes" with that)
Please…

Lama
- 1,313
- 3
- 11
- 10
60
votes
5 answers
Android: Creating custom preference
Is it possible to create an individual preference in an PreferenceScreen?
I would like to code color settings like that:
I know that choosing the color is easy realizable with the ListPreference, but it would be awesome with that kind of…

Jonas
- 1,432
- 3
- 20
- 27
58
votes
6 answers
Android: "BadTokenException: Unable to add window; is your activity running?" at showing dialog in PreferenceActivity
I'd like to ask for some help: In my app, I have only one activity, a PreferenceActivity (don't need other, it's just a simple background-sync app, so the PrefsActivity is the Main/Launcher). After the user setup preferences, checks a…

Lama
- 1,313
- 3
- 11
- 10
53
votes
6 answers
PreferenceActivity: save value as integer
Using a simple EditTextPreference in my preferences activity:
Is there a way…

Laimoncijus
- 8,615
- 10
- 58
- 81
47
votes
4 answers
When to use CheckBox and when Switch
Can anyone can tell me when to use Checkbox and when Switch?
I mean, what is the real login difference between the two in the context of a PreferenceActivity?
For example, will you change the next section to Checkboxes? It's part of a set, but using…

David
- 37,109
- 32
- 120
- 141
43
votes
5 answers
Number Preferences in Preference Activity in Android
What I want to do is I am working on a game of life program. I want to take the time delay and make it a preference, but I want to make it available for people to type in a specific time. The number can be in miliseconds or seconds.
However I'm…

Kinglink
- 819
- 1
- 8
- 14
37
votes
5 answers
Launch new activity from PreferenceActivity
Good day, friends.
I have a PreferenceActivity, it is filled from XML file.
When we press one item, we should launch new activity. How to do it? What should I write in XML-file or in the Java-class?

QuickNick
- 1,921
- 2
- 15
- 30
36
votes
7 answers
How to show and hide preferences on Android dynamically?
Is there a way to dynamically show and hide preferences? In my case, I have a checkbox preference that would disable or enable one of 2 preference groups ("with-" and "without-handicap" groups). While this would be the ideal GUI in a desktop…

Japtar
- 1,125
- 1
- 14
- 24
36
votes
2 answers
Issues with dual-pane preference screens
Problem
Rotating a device from a one-pane portrait PreferenceScreen to a two-pane landscape PreferenceScreen, causes landscape to only show as one-pane. Does NOT occur when viewing the headers screen.
Setup
This is for ICS and up only. I have a…

Ifrit
- 6,791
- 8
- 50
- 79
36
votes
6 answers
PreferenceActivity Android 4.0 and earlier
Trying the different preference activities in the ApiDemos for Android 4.0, I see in the code that some methods are deprecated in PreferencesFromCode.java, for example.
So my question is: if I use PreferenceFragment, will it work for all version or…

just_user
- 11,769
- 19
- 90
- 135
35
votes
10 answers
How do you refresh PreferenceActivity to show changes in the settings?
Based on the following code, can you tell me how to refresh the PreferenceActivity window to show changes in the settings immediately? For example: the user taps the master chime toggle checkbox to true (ticked), I would like the user to immediately…

Emad-ud-deen
- 4,734
- 21
- 87
- 152