Read speed of SharedPreferences

前端 未结 4 1712
庸人自扰
庸人自扰 2020-12-09 15:06

How fast are SharedPreferences? Is there a way to put them in memory for reading? I have a small amount of data that a ListView has to query to d

4条回答
  •  旧时难觅i
    2020-12-09 15:43

    Is there a way to put them in memory for reading?

    They are in memory, after the first reference. The first time you retrieve a specific SharedPreferences (e.g., PreferenceManager.getDefaultSharedPreferences()), the data is loaded from disk, and kept around.

提交回复
热议问题