jeudi 16 avril 2020

How do I link strings from different arrays in Java?

I decided to spend the lockdown refreshing my language skills and therefore wrote a learning app, including a section for learning vocabs. So I copy and pasted a few words, made an array with the language1 vocabs and one with the language2 translations, l1-array strings will be spit out randomly by the program. It's supposed to ask me for the translation, then compare it to the actual one and move the vocabs to different arrays depending on how often I got them right.

So far so easy, but as I have over 400 vocabs, I can't link each l1string to it's l2, so I want the program to do it over the position within the array. I have two arrays:

    <string-array name="voclist">
          <string name="v1">vocab1</string>
          ...
          <string name="v472">vocab472</string>
    </string-array>
    <string-array name="translist">
          <string name="t1">translation1</string>
          ...
          <string name="t472">translation472</string>
    </string-array>
    Random vocab = new Random();
    for (int i=0; i<voclist.length; i++);

And now, in a different TextView, I want the translation to pop up. So something like for v#n import t#n in a way that the program understands it. How do I do that?




Aucun commentaire:

Enregistrer un commentaire