随着Gingerbread的发布,我一直在尝试一些新的API,其中一个是StrictMode.
我注意到其中一个警告是为了getSharedPreferences().
这是警告:
StrictMode policy violation; ~duration=1949 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=23 violation=2
Run Code Online (Sandbox Code Playgroud)
并且它是为getSharedPreferences()在UI线程上进行的调用而给出的.
是否SharedPreferences真的应该从UI线程访问和更改?