Search code examples
androidkotlinandroid-jetpack-composestore

What is the best way to store large amounts of text data for lazycolumn elements?


I am writing an application with a dialog system. Dialogues are formed as sequences of cards with specific text. They may alternate or repeat.

The card consists of an id, an image and text. When loading data, depending on the id, the required card will be displayed.

My question is what is the best way to store this data?

I'm guessing 3 options:

  1. Store data in data classes and text in strings.xml
  2. Store data in xml format and parse data using xml parser
  3. Store room database data

Which method is the most practical and preferred in this case? enter image description here


Solution

  • All of the three options you provided yourself would work perfectly fine!

    To choose in between them you have to answer one simple question: Are you trying to create a dynamic system, in which you can create and delete cards or is it going to be static data?

    Rephrased: Is the effort of implementing everything using a local database worth it, if you're just going to display static data?

    I personally would implement it using a database, as I'd want to at least have the option to eventually do everything dynamically. Also: strings.xml is for static UI elements only IMO.

    Hope this helped! Cheers