Android SharedPreferences.apply()和commit区别 小民工 2021-02-08 599 阅读1分钟 sharedPreferences中Editor的apply()和commit()函数都可以提交修改数据的请求 commit()有返回值,apply()没有返回值,所以无法判断是否提交成功 Commit()是立即同步修改到磁盘,而apply()是先保存到内存中,然年异步同步到磁盘,Note: that when two editors are modifying preferences at the same time, the last one to call apply wins.