/** * you can set Tinker disable in runtime at some times! * * @param context */ public static void setTinkerDisableWithSharedPreferences(Context context) { SharedPreferences sp = context.getSharedPreferences(ShareConstants.TINKER_SHARE_PREFERENCE_CONFIG, Context.MODE_MULTI_PROCESS); String keyName = ShareConstants.TINKER_ENABLE_CONFIG_PREFIX + ShareConstants.TINKER_VERSION; sp.edit().putBoolean(keyName, false).commit(); }
private SharedPreferences mPreferences; .... boolean firstTime = mPreferences.getBoolean("firstTime", true); if (firstTime) { SharedPreferences.Editor editor = mPreferences.edit(); editor.putBoolean("firstTime", false); editor.commit(); showMiddleActivity(); }
public SharedPreferencesUtil putBoolean(String key, boolean value) { editor.putBoolean(key, value); editor.commit(); return this; }
public void activateMonitorService (boolean active) { prefsEditor.putBoolean(MONITOR_SERVICE_ACTIVE,active); prefsEditor.commit(); }
public void activateSms(boolean active) { prefsEditor.putBoolean(SMS_ACTIVE, active); prefsEditor.commit(); }
public void activateHeartbeat(boolean active) { prefsEditor.putBoolean(HEARTBEAT_MONITOR_ACTIVE, active); prefsEditor.commit(); }
final String eulaKey = "mykey"; Context mContext = getApplicationContext(); mPrefs = mContext.getSharedPreferences("myAppPrefs", Context.MODE_PRIVATE); SharedPreferences.Editor editor = mPrefs.edit(); editor.putBoolean(eulaKey, true); editor.commit();
public void setFirstLaunch(boolean firstLaunch) { prefsEditor.putBoolean(FIRST_LAUNCH, firstLaunch); prefsEditor.commit(); }
public void setActivateVideoMonitoring(boolean active) { prefsEditor.putBoolean(context.getResources().getString(R.string.video_active_preference_key), active); prefsEditor.commit(); }
public void activateFlash(boolean active) { prefsEditor.putBoolean(FLASH_ACTIVE, active); prefsEditor.commit(); }
public void activateMicrophone(boolean active) { prefsEditor.putBoolean(MICROPHONE_ACTIVE, active); prefsEditor.commit(); }
public void activateRemoteAccess (boolean active) { prefsEditor.putBoolean(REMOTE_ACCESS_ACTIVE,active); prefsEditor.commit(); }
public void setVoiceVerification(boolean active) { prefsEditor.putBoolean(VOICE_VERIFY_SIGNAL, active); prefsEditor.commit(); }
public void activateCamera(boolean active) { prefsEditor.putBoolean(CAMERA_ACTIVE, active); prefsEditor.commit(); }
public void activateAccelerometer(boolean active) { prefsEditor.putBoolean(ACCELEROMETER_ACTIVE, active); prefsEditor.commit(); }
public void putBoolean(String key, Boolean value) { editor.putBoolean(key, value); editor.commit(); }
// get Editor object SharedPreferences.Editor editor = preferences.edit(); // put values in editor editor.putBoolean("key", value); editor.put..("key", value); // remove single value by key editor.remove("key"); // remove all values editor.clear(); // commit your putted values to the SharedPreferences object synchronously // returns true if success boolean result = editor.commit(); // do the same as commit() but asynchronously (faster but not safely) // returns nothing editor.apply();
// get Editor object SharedPreferences.Editor editor = preferences.edit(); // put values in editor editor.putBoolean("key", value); editor.put..("key", value); // remove single value by key editor.remove("key"); // remove all values editor.clear(); // commit your putted values to the SharedPreferences object synchronously // returns true if success boolean result = editor.commit(); // do the same as commit() but asynchronously (faster but not safely) // returns nothing editor.apply();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); boolean previouslyStarted = prefs.getBoolean(getString(R.string.pref_previously_started), false); if(!previouslyStarted) { SharedPreferences.Editor edit = prefs.edit(); edit.putBoolean(getString(R.string.pref_previously_started), Boolean.TRUE); edit.commit(); showHelp(); }
public void setAlbumsInGrid(final boolean b) { final SharedPreferences.Editor editor = mPreferences.edit(); editor.putBoolean(TOGGLE_ALBUM_GRID, b); editor.apply(); }