I am using SharedPreferences in my android app. I am using both commit() and apply() method from shared preference. When I use AVD 2.3
The docs give a pretty good explanation of the difference between apply() and commit():
Unlike
commit(), which writes its preferences out to persistent storage synchronously,apply()commits its changes to the in-memorySharedPreferencesimmediately but starts an asynchronous commit to disk and you won't be notified of any failures. If another editor on thisSharedPreferencesdoes a regularcommit()while aapply()is still outstanding, thecommit()will block until all async commits are completed as well as the commit itself. AsSharedPreferencesinstances are singletons within a process, it's safe to replace any instance ofcommit()withapply()if you were already ignoring the return value.