samedi 16 mai 2020

How can I generate multiple random buttons with one button click?

I can only generate one number at a time. How can I generate one number then after a second of delay it will automatically generate another one until I press stop?

 public void generate(View view) throws InterruptedException {
Random rand = new Random();
int number = rand.nextInt(20)+1;
    TextView myText  = (TextView)findViewById(R.id.textView);
    String myString = String.valueOf(number);

myText.setText(number);
    TimeUnit.SECONDS.sleep(1);
}



Aucun commentaire:

Enregistrer un commentaire