【Android】SharedPreferences commit(同步)apply(异步)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/tuhuolong/article/details/20644501
Unlike commit(), which writes its preferences out to persistent storage synchronously, apply() commits its changes to the in-memory SharedPreferencesimmediately but starts an asynchronous commit to disk and you won't be notified of any failures. If another editor on this SharedPreferences does a regularcommit() while a apply() is still outstanding, the commit() will block until all async commits are completed as well as the commit itself.
展开阅读全文

没有更多推荐了,返回首页