admin管理员组

文章数量:1530518

在使用Lint检查代码时,得到提示

Consider using apply() instead; commit writes its data to persistent storage immediately, whereas apply will handle it in the background

通过阅读文档得知只要区别在于:

  1. commit() API Level 1。apply() API Level 9。
  2. commit()有boolean返回值,确认是否写入数据成功。applay()无返回值。
  3. commit()立刻写入存储器中,apply立刻提交到内存中并在子线程中写入存储器。

本文标签: 区别EditorSharedPreferencesapplaycommit