x90*_*x90 6 android caching sharedpreferences
我的应用程序中有2个进程.从一个进程我将数据保存到SharedPreferences.从第二个过程 - 检索.当我检索数据时,我收到SharedPreferences旧数据(我检查xml文件,看看,当前收到的文件和数据中的数据是不同的).看起来这个数据是缓存的.我更改了保存方法(提交/应用)但没有结果.PS:例如http://pastebin.com/Zx2ffvSg
//saving
{ ...
SharedPreferences myPrefs = this.getSharedPreferences("myPrefs", MODE_PRIVATE);
SharedPreferences.Editor prefsEditor = myPrefs.edit();
prefsEditor.putString(MY_NAME, "Sai");
prefsEditor.putString(MY_WALLPAPER, "f664.PNG");
prefsEditor.commit();
... }
//retrieving
// when i call getData() I put "this" as argument.
public void getData(Context context){
SharedPreferences myPrefs = context.getSharedPreferences("myPrefs", MODE_PRIVATE);
...}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4944 次 |
| 最近记录: |