[英]Best way to store non-sensitive data in android?
In my android app, I download a huge json string, and want to store it for offline use. 在我的Android应用程序中,我下载了一个巨大的json字符串,并希望将其存储以供离线使用。 Currently I am using shared preferences to store it. 目前,我正在使用共享首选项来存储它。 But I am thinking now it may not be the best way to store a large string. 但是我现在想这可能不是存储大字符串的最佳方法。
Also the data doesn't have to be encrypted. 同样,数据也不必加密。 It can be stored in plain text, so security is not a problem. 它可以以纯文本格式存储,因此安全性不是问题。
Does anyone know if there's a better way? 有谁知道是否有更好的方法?
使用Java文件I / O将 其存储为文件 ,可能在Android的内部存储中 。
You have other options, such as: 您还有其他选择,例如:
Internal Storage, External Storage, SQLite database. 内部存储,外部存储,SQLite数据库。
For more information check http://developer.android.com/guide/topics/data/data-storage.html 有关更多信息,请访问http://developer.android.com/guide/topics/data/data-storage.html
SharedPreferences is a good option. SharedPreferences是一个不错的选择。 It doesnt make any sense to store it in a file, SharedPreferences already does the same thing. 将其存储在文件中没有任何意义,SharedPreferences已经做了同样的事情。 I wouldnt suggest SQLite either because its just a string which still will be saved into a file. 我不建议使用SQLite,因为它只是一个仍将保存到文件中的字符串。 If the strings gets too big then i would suggest to have a method on splitting it into smaller objects then using SQLite for storing. 如果字符串太大,那么我建议使用一种方法将其拆分为较小的对象,然后使用SQLite进行存储。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.