Is it possible to make one int variable from list.get(count-1))
int mNumbers = (list.get(count-1)); does not work.
In the code, it all works, but it does not seem so beautiful to me.
mInfoTextView2.setText(list.get(count-1) + ""); switch (list.get(count-1)) public ArrayList<Integer> list; int i; int maxQ = 20; int selectQ = 10; int iCounter = 0; int iArray[] = new int[selectQ]; // или сколько тебе там надо рандомных чисел, сюда закидаешь @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setHashList(); } private void setHashList() { mInfoTextView=findViewById(R.id.textView); mInfoTextView2=findViewById(R.id.textView2); mInfoTextView3=findViewById(R.id.textView3); list = new ArrayList<>(); for (i = 1; i < maxQ; i++) { list.add(i); } Collections.shuffle(list); mInfoTextView.setText(list.toString()); } public void onClickNext(View view) { //int mNumbers = (**list.get(iCounter-1)**); mInfoTextView3=findViewById(R.id.textView3); mInfoTextView2=findViewById(R.id.textView2); // mInfoTextView3.setText(list.get(list.size() - 1)); Button mBut = findViewById(R.id.button2); i = iArray[iCounter]; iCounter ++; if (iCounter == iArray.length) iCounter = 0; mInfoTextView2.setText(**list.get(iCounter-1**) + ""); mInfoTextView3.setText((iCounter) + ""); if (iCounter == selectQ-1) {mBut.setEnabled(false);} else { switch (**list.get(iCounter-1)**) { case 1: { Log.d(TAG, "ТУТ:1"); } break; case 2: { Log.d(TAG, "ТУТ:2"); so everything works ... the question is how to make list.get (iCounter-1 variable int
int mNumbers = (list.get(count-1));,mInfoTextView2.setText(mNumbers + "");,switch (mNumbers)then everything should work. - not a Programmer