use of android.content.SharedPreferences in project UltimateAndroid by cymcsg.
the class PreferencesUtils method clearSharePreference.
public static void clearSharePreference(Context context, String preferenceName) {
SharedPreferences sharedPreferences = context.getSharedPreferences(preferenceName, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.clear();
editor.commit();
}
use of android.content.SharedPreferences in project UltimateAndroid by cymcsg.
the class PreferencesUtils method putBoolean.
/**
* Put boolean to preferences with custom preference
*
* @param context
* @param preferenceName The custom preference name
* @param key The name of the preference to modify
* @param value The new value for the preference
* @return Returns true if the new values were successfully written to persistent storage.
*/
public static boolean putBoolean(Context context, String preferenceName, String key, boolean value) {
SharedPreferences sharedPreferences = context.getSharedPreferences(preferenceName, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(key, value);
return editor.commit();
}
use of android.content.SharedPreferences in project android by cSploit.
the class SettingsFragment method onCreate.
@SuppressWarnings("ConstantConditions")
@Override
public void onCreate(Bundle savedInstanceState) {
SharedPreferences themePrefs = getActivity().getSharedPreferences("THEME", 0);
if (themePrefs.getBoolean("isDark", false))
getActivity().setTheme(R.style.PrefsThemeDark);
else
getActivity().setTheme(R.style.PrefsTheme);
super.onCreate(savedInstanceState);
getActivity().getSupportFragmentManager().beginTransaction().replace(android.R.id.content, new PrefsFrag()).commit();
}
use of android.content.SharedPreferences in project cw-advandroid by commonsguy.
the class C2DMessaging method setRegistrationId.
// package
static void setRegistrationId(Context context, String registrationId) {
final SharedPreferences prefs = context.getSharedPreferences(PREFERENCE, Context.MODE_PRIVATE);
Editor editor = prefs.edit();
editor.putString("dm_registration", registrationId);
editor.commit();
}
use of android.content.SharedPreferences in project cw-advandroid by commonsguy.
the class C2DMessaging method setBackoff.
static void setBackoff(Context context, long backoff) {
final SharedPreferences prefs = context.getSharedPreferences(PREFERENCE, Context.MODE_PRIVATE);
Editor editor = prefs.edit();
editor.putLong(BACKOFF, backoff);
editor.commit();
}
Aggregations