Which is the best way to store "quotes" in an android app

146 views Asked by At

I'm creating an app where it can have tons of messages (let's say around 10,000). The user can browse them, see, select, send (e.g., those apps that show quotes and allows to send to someone). What should be the best way to store these messages? In the strings.xml, or in my own xml file. The app should work offline, so I do not consider using any internet connection or remote database, or even SQLite (once the messages will come with the app when the user installs it). When the user executes the app for the first time, the idea is to get all these messages (from strings, or other xml) and create a SQLite database. Which suggestion do you have?

2

There are 2 answers

0
CommonsWare On BEST ANSWER

What should be the best way to store these messages?

SQLite.

once the messages will come with the app when the user installs it

Use SQLiteAssetHelper to ship a SQLite database with your app containing your quotes.

Bonus points for using FTS3 (or FTS4, depending on your minSdkVersion) for supporting full-text searching. :-)

0
Shully On

Since it seems like you don't want to use a database, you can just make use of your strings.xml file and hardcode the quotes. Or like you said you could create your own xml. Whichever consumes less space on the user's device will be more preferable. Choice is yours...