Home » Android » Storing multiple lists of words permanently

Storing multiple lists of words permanently

Posted by: admin November 1, 2017 Leave a comment

Questions:

This question might be a bit complex, but I´ll try anyway:

I am making an app which gathers a list of words in one language, and the translations of each word. Both in the same String array. I want the user to be able to store lists which he has made permanently, so they can be found later for practice. I have made a sketch underneath. It is very simplified.

In Activity1 the user chooses weather to make a new vocabulary list, or choose an old one (which then have had to be stored earlier). If the user makes a new list, he can choose to store it in Activity3. Between Activity2 and Activity3 there will be an Activity where the user practices translations of his vocabularylist. For simplicity, I have dropped this activity in the sketch.

How can I programatically make it possible to save vocabularylists that are made as String arrays from Activity3, and how can I give each list/array a name which the user can pick if he wants to choose an old list from Activity1?

I would be very thankful if someone could please guide me 🙂

enter image description here

Answers:

Why are you putting all the words including translations in a single string array? Is it really required? Acc to the scenario, I don’t think so..

Let’s say the translation is required in only 1 language.

  1. Make an SQLite table with three cols (id, word and word_trans)
  2. In Activity2 perform insert operation on each word.
  3. In Activity3 SELECT all the words, show them in a list and practice the translations. For a particular word translation, UPDATE the sqlite-row and set word_trans value into that.
  4. Now you have a table of user words, you can select it any time you want with the translation