dimanche 23 juillet 2017

How to get multiple random values from an array?

I'm working on my first project for android using java.

I have a questions class ;

public class Question {
    private int id;
    private String questionText;
    private String answer;
    private TextView textQuestion;

    public Question(int id, String questionText, String answer,TextView textQuestion) {
        this.id = id;
        this.questionText = questionText;
        this.answer = answer;
        this.textQuestion= textQuestion;
    }
}

I will create arrays and store some questions and answers using this class.But my problem is for example for id = 0 it will be the letter "A" , and i would like to have at least 5 questions for letter "A".

Question[] questions = new Question[24];
questions[0] = new Question(0, "Question","Answer",textView);

If i do like this i can only store one question for id = 0 and letter "A".What should i do ?




Aucun commentaire:

Enregistrer un commentaire