最有效的方式来存储和检索的Andr​​oid大量的文字资料 [英] Most efficient way to store and retrieve large amounts of text data in android

查看:93
本文介绍了最有效的方式来存储和检索的Andr​​oid大量的文字资料的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要写一个将存储和检索大量的文本数据的android应用。我想存储文本段落wise.I需要以一种有效的方式来处理这个文本数据。这将是最好的方式这样做?

I wanna write an android application which will store and retrieve large amounts of text data. I wanna store text in paragraph wise.I need to manipulate this text data in an efficient way. What will be the best way for doing this?

推荐答案

我认为最好的办法是保存一个文件中的所有数据。而在SD卡将该文件保存到指定的位置。如果您在文件中保存的数据,你会得到相同的格式保存(例如段落你的情况明智的)。而当过你愿意,你可以删除的文件。

I think the best way is to save all data inside a file. And save this file to specified location in sdcard. If you are saving data inside a file you will get same format as you saved(e.g Paragraph wise in your case).And you can delete file when ever you want.

我觉得这可能此帮助您解决您的问题。

I found this may this help you to solve your issue

共享preferences 显然在内部实现为序列化和反序列化全面更新上的XML文件。而且它是没有索引的键值存储。因此,使用与应用相关联只为简单的数据。任何超过50个键,你可能已经过头了。

SharedPreferences is apparently implemented internally as an XML file which is serialized and deserialized in full on update. And it's a Key-Value store with no index. So use that only for simple data associated with your app. Any more than 50 keys and you've probably overdone it.

的ContentProvider 适用于在应用程序之间共享数据。你已经明确表示你不想这样做。

ContentProvider is intended for sharing data across applications. You've explicitly said you don't want to do that.

SQLiteDatabase 适用于单个应用程序存储数据,并提供了很大的灵活性来存储和索引数据以不同的方式。我个人用它来存储日志在我的应用程序之一。我建议路线。

SQLiteDatabase is intended for individual apps to store data, and provides a lot of flexibility to store and index data in different ways. I personally use it to store logs in one of my apps. I'd recommend that route.

详情请参见本次讨论

这篇关于最有效的方式来存储和检索的Andr​​oid大量的文字资料的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆