Java: java.util.Preferences Failing

Unfortunately most of the answers you got here are wrong … at least slightly. In the sense that the symptom is being treated, not the cause. Let’s recap. Java Preferences has two “trees”: the user tree and the system tree. You can write your own backend to Java Preferences (called a backing store) but few … Read more

Tab Vs Space preferences in Vim

Creating a stab option in Vim itself would not be easy, but I’ve whipped up this command/function that you can drop in your .vimrc (or a plugin file if you’re super-organized). Use :Stab and you will be prompted for an indent level and whether or not to use expandtab. If you hit enter without giving … Read more

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

this question is similar to mine: initialize-preferences-from-xml-in-main-activity Just use this code in onCreate method: PreferenceManager.setDefaultValues(this, R.xml.preference, false); It will load your preferences from XML, and last parameter (readAgain) will guarantee that user preferences won’t be overwritten. That means setting the readAgain argument to false means this will only set the default values if this method … Read more

Remove/hide a preference from the screen

If your Preference is within a PreferenceCategory, you have to do this: XML: <PreferenceCategory android:key=”category_foo” android:title=”foo”> <CheckBoxPreference android:key=”checkPref” /> Java: CheckBoxPreference mCheckBoxPref = (CheckBoxPreference) findPreference(“checkPref”); PreferenceCategory mCategory = (PreferenceCategory) findPreference(“category_foo”); mCategory.removePreference(mCheckBoxPref);

Referencing a string in a string array resource with xml

In short: I don’t think you can, but there seems to be a workaround:. If you take a look into the Android Resource here: http://developer.android.com/guide/topics/resources/string-resource.html You see than under the array section (string array, at least), the “RESOURCE REFERENCE” (as you get from an XML) does not specify a way to address the individual items. … Read more

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

In general SharedPreferences are your best bet for storing preferences, so in general I’d recommend that approach for saving application and user settings. The only area of concern here is what you’re saving. Passwords are always a tricky thing to store, and I’d be particularly wary of storing them as clear text. The Android architecture … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)