public final class EncryptedPreferences.EncryptedEditor
extends java.lang.Object
EncryptedPreferences object. All changes you make in an editor are batched, and not copied back to the
original EncryptedPreferences until you call apply().| 限定符和类型 | 方法和说明 |
|---|---|
void |
apply()
Commit your preferences changes back from this Editor to the
EncryptedPreferences object it is editing. |
EncryptedPreferences.EncryptedEditor |
clear()
Mark in the editor to remove all values from the preferences.
|
boolean |
commit()
Commit your preferences changes back from this Editor to the
EncryptedPreferences object it is editing. |
EncryptedPreferences.EncryptedEditor |
putBoolean(java.lang.String key,
boolean value)
Set a boolean value in the preferences editor, to be written back once apply() is called.
|
EncryptedPreferences.EncryptedEditor |
putFloat(java.lang.String key,
float value)
Set a float value in the preferences editor, to be written back once apply() is called.
|
EncryptedPreferences.EncryptedEditor |
putInt(java.lang.String key,
int value)
Set an int value in the preferences editor, to be written back once apply() is called.
|
EncryptedPreferences.EncryptedEditor |
putLong(java.lang.String key,
long value)
Set a long value in the preferences editor, to be written back once apply() is called.
|
EncryptedPreferences.EncryptedEditor |
putString(java.lang.String key,
java.lang.String value)
Set a String value in the preferences editor, to be written back once apply() is called.
|
EncryptedPreferences.EncryptedEditor |
remove(java.lang.String key)
Mark in the editor that a preference value should be removed, which will be done in the actual preferences once apply() is called.
|
public EncryptedPreferences.EncryptedEditor putString(java.lang.String key, java.lang.String value)
key - - The name of the preference to modifyvalue - - The new value for the preferencepublic EncryptedPreferences.EncryptedEditor putInt(java.lang.String key, int value)
key - - The name of the preference to modifyvalue - - The new value for the preferencepublic EncryptedPreferences.EncryptedEditor putLong(java.lang.String key, long value)
key - - The name of the preference to modifyvalue - - The new value for the preferencepublic EncryptedPreferences.EncryptedEditor putFloat(java.lang.String key, float value)
key - - The name of the preference to modifyvalue - - The new value for the preferencepublic EncryptedPreferences.EncryptedEditor putBoolean(java.lang.String key, boolean value)
key - - The name of the preference to modifyvalue - - The new value for the preferencepublic EncryptedPreferences.EncryptedEditor remove(java.lang.String key)
key - - The name of the preference to removepublic EncryptedPreferences.EncryptedEditor clear()
public void apply()
EncryptedPreferences object it is editing. This atomically performs the
requested
modifications, replacing whatever is currently in the EncryptedPreferences.public boolean commit()
EncryptedPreferences object it is editing. This atomically
performs the requested modifications, replacing whatever is currently
in the EncryptedPreferences.
Note that when two editors are modifying preferences at the same time, the last one to call commit wins.
If you don't care about the return value and you're
using this from your application's main thread, consider
using apply() instead.