对于没有在线访问的 save/cache 大量数据,有没有比 SharedPreferences 更好的替代方法?

Any better alternative instead of SharedPreferences to save/cache much data without online access?

在没有网络连接的情况下,手机内存大容量存储最好的实现是什么? 因为 sharedpreferences 可能会下降 ...

您可以在移动设备上将大量数据存储在本地数据库中,例如 SQLite、RealM、Room DB。

参考资料,您可以点击以下链接:

1. SQLite: https://www.tutorialspoint.com/android/android_sqlite_database.htm

2。 RealM : https://www.androidhive.info/2016/05/android-working-with-realm-database-replacing-sqlite-core-data/

3。房间数据库: https://medium.com/@tonia.tkachuk/android-app-example-using-room-database-63f7091e69af

肯定是 SQLite。它速度很快,您可以自定义自己的函数以访问您想要的数据。

您可以使用 SQLite 数据库并将您的数据保存为对象 ,为了便于使用,您可以使用 room library 来实现,此 link 以获取更多信息: https://developer.android.com/training/data-storage/room

正如大多数开发人员所建议的,并且通常更喜欢 SQLite,请放心,您可以继续使用 SQLite。但它有自己的优点和缺点。

SQLite:https://www.tutorialspoint.com/android/android_sqlite_database.htm 共享偏好:https://developer.android.com/reference/android/content/SharedPreferences