Should accessing SharedPreferences be done off the UI Thread?

前端 未结 6 1031
执笔经年
执笔经年 2020-11-29 15:41

With the release of Gingerbread, I have been experimenting with some of the new API\'s, one of them being StrictMode.

I noticed that one of the warnings is for

6条回答
  •  野性不改
    2020-11-29 16:04

    i do not see any reason to read them from a background thread. but to write it i would. at startup time the shared preference file is loaded into memory so its fast to access, but to write things can take a bit of time so we can use apply the write async. that should be the difference between commit and apply methods of shared prefs.

提交回复
热议问题