Как установить текст arraylist кнопки в android
I am making a random number generator app in this app we will take the random number range like 0-100 then when we click on the generate btn it will set the number on the button. Manually we can set that value of random number and set it on button.if i set the random number 4 will always correct it means the fourth button will always be correct. Now i want to make the shuffle of random number on button so i create the Random number Array and ArrayList of button so i add it on the ArrayList but i don't know how to set the value of random number array on arraylist of button.If there is an other way to solve this problem then guide me
Что я уже пробовал:
package com.example.quizoptioninarraylist; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.util.ArrayList; import java.util.Random; public class MainActivity extends AppCompatActivity { Button genbtn,optbtn1,optbtn2,optbtn3,optbtn4; EditText mintext,maxtext; Random rand[]=new Random[4]; int minrange,maxrange; ArrayList <Button>shufflearray=new ArrayList<Button>(); int random[]=new int[4]; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); genbtn=(Button)findViewById(R.id.gen); shufflearray.add((Button)findViewById(R.id.opt1)); shufflearray.add((Button)findViewById(R.id.opt2)); shufflearray.add((Button)findViewById(R.id.opt3)); shufflearray.add((Button)findViewById(R.id.opt4)); mintext=(EditText)findViewById(R.id.min); maxtext=(EditText)findViewById(R.id.max); genbtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { minrange=Integer.parseInt(mintext.getText().toString()); maxrange=Integer.parseInt(maxtext.getText().toString()); for(int i=0;i<rand.length;i++){ random[i]=rand[i].nextInt(maxrange-minrange)+maxrange; } for(int i=0;i<shufflearray.size();i++) { } } }); } }