Top "Sharedpreferences" questions

SharedPreferences allows you to save and retrieve persistent key-value pairs of primitive data types in Android applications.

SharedPreferences value is not updated

I am trying to update the values of SharedPreferences, here is my code: edit = PreferenceManager.getDefaultSharedPreferences(this).edit(); edit.putString(…

android xml sharedpreferences
Logout clear SharedPreferences

I have a login page that saves username and password to SharedPreferences. I have another Activity class that includes a …

android sharedpreferences logout
How do I get preferences to work in Android?

I've really been struggling through this. New to Java/Android. I'm writing my first app and this is the first …

android variables settings preferences sharedpreferences
Using shared preferences editor

I'm slowly working through an Android learning book and was given the following code to assign user data: package com.…

android sharedpreferences
Why does preferences.getString("key", "DEFAULT") always return "DEFAULT"?

I have user_preferences.xml in my XML directory. A PreferencesActivity uses this file to create the user preferences activity.. …

android sharedpreferences listpreference
How to iterate through all keys of shared preferences?

SharedPreferences have method getAll, but it returns no entries despite the fact some keys exist: PreferenceManager.getDefaultSharedPreferences(this).contains("addNewAddress"); …

android sharedpreferences
Is String a primitive or an Object in Android or Java?

In the Android API http://developer.android.com/guide/topics/data/data-storage.html#pref It says: Shared Preference allows you …

java android string sharedpreferences primitive
PreferenceActivity: save value as integer

Using a simple EditTextPreference in my preferences activity: <EditTextPreference android:key="SomeKey" android:title="@string/some_title" android:summary="..." …

android sharedpreferences preferenceactivity
Best option to store username and password in android app

I am developing an Android app where the user needs to sign in to perform operations. But mostly on an …

android android-sqlite sharedpreferences android-preferences
How to store a boolean value using SharedPreferences in Android?

I want to save boolean values and then compare them in an if-else block. My current logic is: boolean locked = …

android if-statement boolean sharedpreferences