Questions tagged [preferences]

The java.util.prefs package provides a way for applications to store and retrieve user and system preference and configuration data.

1502 questions
312
votes
15 answers

What is the most appropriate way to store user settings in Android application

I am creating an application which connects to the server using username/password and I would like to enable the option "Save password" so the user wouldn't have to type the password each time the application starts. I was trying to do it with…
Niko Gamulin
  • 63,517
  • 91
  • 213
  • 274
273
votes
5 answers

Referencing a string in a string array resource with xml

I have preferences where you can enable/disable what items will show up on the menu. There are 17 items. I made a string array in values/arrays.xml with titles for each of these 17 items. I have preferences.xml which has the layout for my…
Jorsher
  • 3,513
  • 3
  • 15
  • 12
155
votes
5 answers

Setting Vim whitespace preferences by filetype

At my work, I am required to follow the house style for indentation, which goes as follows: 2 spaces when coding html and ruby tabs when coding javascript, with tabwidth=4 recommended What is the best way to specify different whitespace…
nelstrom
  • 17,106
  • 12
  • 51
  • 65
139
votes
15 answers

Remove/hide a preference from the screen

I have an activity which extends PreferenceActivity. I'm loading preferences from the xml file. But in some cases i need completely hide one of the preferences from the screen based on my app state. There is a setEnabled method, but it's not exactly…
Alex Volovoy
  • 65,307
  • 13
  • 71
  • 53
130
votes
4 answers

How to securely store access token and secret in Android?

I am going to use oAuth to fetch mails and contacts from google. I don't want to ask the user each time to log in to obtain an access token and secret. From what I understood, I need to store them with my application either in a database or…
yeahman
  • 2,478
  • 4
  • 16
  • 22
126
votes
6 answers

Android Preferences: How to load the default values when the user hasn't used the preferences-screen?

I am using a PreferenceActivity to let the user set some values. I am feeding it the xml file with the defined preferences. I have set all the android:defaultValue="" for them. When I start my application, I need the preferences, or if they are not…
Peterdk
  • 14,529
  • 18
  • 97
  • 136
87
votes
7 answers

Tab Vs Space preferences in Vim

Vim is very accommodating when it comes to tab Vs. space preferences. As I understand it, the tabstop setting indicates the width of a tab character. The shiftwidth setting specifies how many columns to increment/decrement when using the << and >>…
nelstrom
  • 17,106
  • 12
  • 51
  • 65
66
votes
11 answers

Java: java.util.Preferences Failing

My program saves encrypted product key data to the computer with the java.util.Preferences class (system preferences, not user). The problem is, on both Windows and Linux (haven't tested on OSX, but it's probably the same), if I don't run the…
Jonah
  • 9,535
  • 5
  • 39
  • 74
63
votes
5 answers

How to do opposite of of preference attribute android:dependency?

Is there XML attribute that does the exact opposite of android:dependency? What I would like the dependent preference to be enabled when the other is NOT checked and disabled when it IS checked. edit: maybe the issue isn't with android:dependency…
brybam
  • 4,809
  • 12
  • 48
  • 92
53
votes
4 answers

Cocoa - Notification on NSUserDefaults value change?

Let's say I have a key @"MyPreference", with a corresponding value stored through NSUserDefaults. Is there a way to be notified when the value is modified? Or could it be done through bindings? (But this case, instead of binding the value to a UI…
SirRatty
  • 1,631
  • 3
  • 17
  • 18
50
votes
4 answers

Where are the Java preferences stored in Windows 7?

We use the Java preferences in some of our apps and haven't really noticed this since the utility that makes the calls is fairly old and was written in Windows XP days. But it seems the Java preferences are no longer stored in the registry in…
javamonkey79
  • 16,837
  • 35
  • 104
  • 166
48
votes
7 answers

Best approach to save user preferences?

I have seen two different approaches in saving user preferences. APPROACH 1: Serializing them and saving in one of the column of USERS table APPROACH 2: Creating a separate table PREFERENCES and make a has_many association from USERS to…
Dharam Gollapudi
  • 5,962
  • 2
  • 29
  • 40
44
votes
5 answers

Android shared preferences not saving

I've created an Android live wallpaper and i'm trying to let a user choose an image from their phone and apply it as a background image, but when I launch the activity that start the intent to pick the images, my shared preferences don't seem to…
jOE
  • 461
  • 1
  • 4
  • 5
44
votes
2 answers

Where are Java preferences stored on Mac OS X?

On Windows, the Java preferences, which you access in your application from java.util.prefs.Preferences are stored in the registry. Where are those stored on Mac OS X?
avernet
  • 28,976
  • 43
  • 119
  • 160
40
votes
5 answers

Android: No Activity found to handle Intent error? How it will resolve

No Activity found to handle Intent error? How it will resolve. Preference customPref = (Preference) findPreference("DataEntryScreen"); customPref .setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean…
1
2 3
99 100