The java.util.prefs package provides a way for applications to store and retrieve user and system preference and configuration data.
Questions tagged [preferences]
1531 questions
9
votes
8 answers
Update existing Preference-item in a PreferenceActivity upon returning from a (sub)PreferenceScreen
I have a PreferenceActivity with a bunch of (Sub)PreferenceScreens. Each such (Sub)PreferenceScreen represents an account and has the account-username as its title.
PreferenceScreen root = mgr.createPreferenceScreen(this);
for (MyAccountClass…

aioobe
- 413,195
- 112
- 811
- 826
9
votes
1 answer
How to detect when an inner PreferenceScreen has been closed
I have a inner PreferenceScreen (call it Users) inside another PreferenceScreen (call it Main).
When i tap Users a new screen opens and I can change my Preferences there (a lot of CheckBoxes).
I want to detect (fire a callback) when this screen is…

Jesno Gianoli
- 163
- 5
9
votes
2 answers
What happens to the existing data of Android user preferences when preferences structure changes in a new version?
For example, if a few entries of preferences are added or deleted, how does Android handle the existing preference data when the app is updated with the new preferences structure?
I am sorry for this rudimentary question, but my diligent search and…

Hong
- 17,643
- 21
- 81
- 142
9
votes
4 answers
Is it okay to register defaults to NSUserDefaults from multiple classes in my app?
I have read and understand the way NSUserDefaults can be used to save preferences for my app to the file system. I am also aware of the need to register defaults before using them later in the app.
What I am not sure of, however, is if it is okay to…

Richard Altenburg - Brainchild
- 1,079
- 9
- 11
8
votes
3 answers
Persisting user preferences in Silverlight
I am working on a Silverlight client and associated ASP.NET web services (not WCF), and I need to implement some features containing user preferences such as a "favourite items" system and whether they'd like word-wrapping or not. In order to make a…

Jeff Yates
- 61,417
- 20
- 137
- 189
8
votes
3 answers
How to create a custom preference with a neutral button?
I use the code below to create a custom preference. The xml layout file has a Button, EditText and TextView. This custom layout appears inside an Alert with "OK" and "Cancel" buttons. This all works well.
I would like to add a third button (a…

Mel
- 6,214
- 10
- 54
- 71
8
votes
1 answer
Process the value of preference before save in Android?
I need to crypt my password before save it to local android database. Everything work fine without encryption, I have preferences.xml and so. How can I call a function after I change value of preference (for example, password) ? Here is my…

EvanBlack
- 759
- 8
- 25
8
votes
1 answer
add specific named SharedPreferences from resource in PreferenceActivity or PreferenceFragment
If I have a Preference-Activity or -Fragment I can provide a preference.xml file to build my PreferenceScreen and show it via addPreferenceFromResource(R.xml.preference)
Changed values can then be retrieved by…

Rafael T
- 15,401
- 15
- 83
- 144
8
votes
1 answer
Can SharedPreferences be shared among different Android applications?
As I checked in APIs description for getSharedPreferences(String, int),Second attribute is defining accessibility mode and can take 0 or MODE_PRIVATE for the default operation, MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE to control permissions.
But…

Migan
- 83
- 1
- 3
8
votes
16 answers
Programming preference - use else ifs with multiple return statements?
The code:
public String getTemperatureMessage(double temp)
{
if(temp < 32)
return "Freezing";
else if(temp < 60)
return "Brr";
else if(temp < 80)
return "Comfortable";
else
return "Too…

Sam Baird
- 95
- 1
- 5
8
votes
1 answer
Android preference activity IllegalArgumentException: Invalid fragment for this activity
I have a problem with my preference activity.
I've created to preference screens and one preference activity.
On my phone with Android 4.2.2 it works fine.
But on Android Emulator with Android 5.0 it crashes with this error:…

Peter234
- 1,052
- 7
- 24
8
votes
2 answers
User preferences in Java EE application
I have a growing web application which now needs to be able to store user and system preferences / settings. In the past I've always rolled my own preferences system for web applications but I was wondering what other people do to solve this…

wobblycogs
- 4,083
- 7
- 37
- 48
8
votes
4 answers
Is it possible to load ListPreference items from an adapter?
I'm setting out to create a settings activity for my app. I've defined a PreferenceActivity with a nice layout including a ListPreference object for the user to select a bluetooth device. I'm having trouble dynamically populating the list.
I would…

Brad Hein
- 10,997
- 12
- 51
- 74
8
votes
14 answers
Preferred Windows Java Development Environment
I've been a Linux Java developer for years and have loved it. I just got a new laptop which is running Windows 7. I could wipe the drive and go back to my typical Linux dev setup: vim for editing, tabbed Bash windows running javac and java for…

JF.
- 163
- 1
- 1
- 7
8
votes
2 answers
Nested preference screens lose theming
I have a preference screen for my application and in the manifest I have given it a theme using:
android:theme="@android:style/Theme.Light.WallpaperSettings"
However when I nest another preference screen inside this one such as:

stealthcopter
- 13,964
- 13
- 65
- 83