Search code examples
javaandroidstringsqlitephrases

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


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?


Solution

  • 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. :-)