Honestly, I do everything that I do in the user interface thread, regardless of whether I need to do this, and I never noticed slight fluctuations even on slower devices. This is pretty damn fast. However, this is I / O, so doing it asynchronously, of course, will not be bad. For entries, if you are targeting API 9 or higher, you can use apply() instead of commit() , which does this asynchronously for you.
Regarding your question about the preference listener, yes, you can also do this:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences preferences, String key) { if("my_preference_key".equals(key) {
source share