Search in sources :

Example 26 with SharedPreferences

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();
}
Also used : SharedPreferences(android.content.SharedPreferences)

Example 27 with SharedPreferences

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();
}
Also used : SharedPreferences(android.content.SharedPreferences)

Example 28 with SharedPreferences

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();
}
Also used : SharedPreferences(android.content.SharedPreferences)

Example 29 with SharedPreferences

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();
}
Also used : SharedPreferences(android.content.SharedPreferences) Editor(android.content.SharedPreferences.Editor)

Example 30 with SharedPreferences

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();
}
Also used : SharedPreferences(android.content.SharedPreferences) Editor(android.content.SharedPreferences.Editor)

Aggregations

SharedPreferences (android.content.SharedPreferences)1653 Intent (android.content.Intent)206 View (android.view.View)101 Editor (android.content.SharedPreferences.Editor)100 TextView (android.widget.TextView)64 Context (android.content.Context)56 File (java.io.File)56 PendingIntent (android.app.PendingIntent)55 IOException (java.io.IOException)55 ArrayList (java.util.ArrayList)52 Bundle (android.os.Bundle)40 JSONObject (org.json.JSONObject)40 JSONException (org.json.JSONException)39 DialogInterface (android.content.DialogInterface)37 SuppressLint (android.annotation.SuppressLint)33 AdapterView (android.widget.AdapterView)32 ImageView (android.widget.ImageView)32 ListView (android.widget.ListView)32 ComponentName (android.content.ComponentName)31 AlertDialog (android.app.AlertDialog)26