jeudi 26 septembre 2019

random order quiz ِDynamic

I want my program to ask random questions and have dynamic answers But it only asks random questions and I need a dynamic answer

Button btn_1,btn_2;
TextView text;
setContentView(R.layout.activity_main);
btn_1=findViewById(R.id.btn_1);
btn_2=findViewById(R.id.btn_2);
text=findViewById(R.id.text);

int min = 1;
int max = 3;

Random r = new Random();
int rand = r.nextInt(max - min + 1) + min;
String[]question={"What is Name Color Sky ?",
      "What is Name Color Night?",
        "What is Blood Color?"
};

String[]answer={"Blue ",
        "Black",
        "White",
        "Red",
        "Green"
        ,"Purple"

};
text.setText(question[rand]); }

Screen




Aucun commentaire:

Enregistrer un commentaire