SharedPreferences.Editor(示例,出错代码)
来源:互联网 发布:百度网盘搜索源码 编辑:程序博客网 时间:2024/05/22 17:19
From:http://www.apihome.cn/api/android/SharedPreferences.Editor.html
android.content
接口 SharedPreferences.Editor
- 正在封闭接口:
- SharedPreferences
public static interface SharedPreferences.Editor
Interface used for modifying values in a SharedPreferences object. All changes you make in an editor are batched, and not copied back to the original SharedPreferences or persistent storage until you call commit().
SharedPreferences.Editor
clear()
Mark in the editor to remove all values from the preferences.
boolean
commit()
Commit your preferences changes back from this Editor to the SharedPreferences object it is editing.
SharedPreferences.Editor
putBoolean(String key, boolean value)
Set a boolean value in the preferences editor, to be written back once commit() is called.
SharedPreferences.Editor
putFloat(String key, float value)
Set a float value in the preferences editor, to be written back once commit() is called.
SharedPreferences.Editor
putInt(String key, int value)
Set an int value in the preferences editor, to be written back once commit() is called.
SharedPreferences.Editor
putLong(String key, long value)
Set a long value in the preferences editor, to be written back once commit() is called.
SharedPreferences.Editor
putString(String key, String value)
Set a String value in the preferences editor, to be written back once commit() is called.
SharedPreferences.Editor
remove(String key)
Mark in the editor that a preference value should be removed, which will be done in the actual preferences once commit() is called.
putString
SharedPreferences.Editor putString(String key, String value)
- Set a String value in the preferences editor, to be written back once commit() is called.
- 参数:
key
- The name of the preference to modify.value
- The new value for the preference.- 返回:
- Returns a reference to the same Editor object, so you can chain put calls together.
putInt
SharedPreferences.Editor putInt(String key, int value)
- Set an int value in the preferences editor, to be written back once commit() is called.
- 参数:
key
- The name of the preference to modify.value
- The new value for the preference.- 返回:
- Returns a reference to the same Editor object, so you can chain put calls together.
putLong
SharedPreferences.Editor putLong(String key, long value)
- Set a long value in the preferences editor, to be written back once commit() is called.
- 参数:
key
- The name of the preference to modify.value
- The new value for the preference.- 返回:
- Returns a reference to the same Editor object, so you can chain put calls together.
putFloat
SharedPreferences.Editor putFloat(String key, float value)
- Set a float value in the preferences editor, to be written back once commit() is called.
- 参数:
key
- The name of the preference to modify.value
- The new value for the preference.- 返回:
- Returns a reference to the same Editor object, so you can chain put calls together.
putBoolean
SharedPreferences.Editor putBoolean(String key, boolean value)
- Set a boolean value in the preferences editor, to be written back once commit() is called.
- 参数:
key
- The name of the preference to modify.value
- The new value for the preference.- 返回:
- Returns a reference to the same Editor object, so you can chain put calls together.
remove
SharedPreferences.Editor remove(String key)
- Mark in the editor that a preference value should be removed, which will be done in the actual preferences once commit() is called.
Note that when committing back to the preferences, all removals are done first, regardless of whether you called remove before or after put methods on this editor.
- 参数:
key
- The name of the preference to remove.- 返回:
- Returns a reference to the same Editor object, so you can chain put calls together.
clear
SharedPreferences.Editor clear()
- Mark in the editor to remove all values from the preferences. Once commit is called, the only remaining preferences will be any that you have defined in this editor.
Note that when committing back to the preferences, the clear is done first, regardless of whether you called clear before or after put methods on this editor.
- 返回:
- Returns a reference to the same Editor object, so you can chain put calls together.
commit
boolean commit()
- Commit your preferences changes back from this Editor to theSharedPreferences object it is editing. This atomicallyperforms the requested modifications, replacing whatever is currentlyin the SharedPreferences.
Note that when two editors are modifying preferences at the sametime, the last one to call commit wins.
- 返回:
- Returns true if the new values were successfully writtento persistent storage.
- SharedPreferences.Editor(示例,出错代码)
- SharedPreferences示例代码
- SharedPreferences、editor
- SharedPreferences、editor
- SharedPreferences、editor
- AlarmManager(示例,出错代码)
- NetworkInfo(示例,出错代码)
- AbstractTableModel(示例,出错代码)
- PrintWriter(示例,出错代码)
- Field(示例,出错代码)
- Calendar(示例,出错代码)
- SimpleDateFormat(示例,出错代码)
- TransformerFactory(示例,出错代码)
- SocketChannel(示例,出错代码)
- DefaultTableModel(示例,出错代码)
- Toolkit(示例,出错代码)
- SharedPreferences.Editor commit ->apply
- SharedPreferences与editor
- 决策树学习中遇到的问题
- 离散傅里叶变换的基本概念
- 二分法
- 再次认识mysql(六)触发器
- 顺序栈的基本操作
- SharedPreferences.Editor(示例,出错代码)
- Android之浅析回调
- 24. Swap Nodes in Pairs
- android_AsyncTask的源码解析
- C语言(7)------使用typedef自定义数据类型
- 初接触计算机图形学看到的一些有趣的英文
- JAVA基础.JAVA基础语法
- 部分语言的数组方式
- 21. Merge Two Sorted Lists