Frankly I do all of mine on the UI thread, whether or not I should, and I've never noticed a slight amount of hesitation even on slower devices. It's pretty damn quick. That said, it is I/O, so doing it asynchronously certainly wouldn't be a bad thing. For writes, if you're targeting API 9 and above, you can use apply()
instead of commit()
which does it asynchronously for you.
As for your question on a preference change listener, yes you can do that as well:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
prefs.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
if("my_preference_key".equals(key) {
//Handle it here
}
}
}