i have 6 buttons in an array and 4 textViews in an array. when a random button is clicked its value will be set on textView[0] and when the next random button is clicked its value will be set on textView[1]. what i'm trying to do is when 4 random buttons are clicked the 2 remaining buttons should be disabled since i only have 4 textViews. how should i do this?
textView[0] = (TextView)findViewById(R.id.t1);
textView[1] = (TextView)findViewById(R.id.t2);
textView[2] = (TextView)findViewById(R.id.t3);
textView[3] = (TextView)findViewById(R.id.t4);
final Button button[] = new Button[6];
button[0] = (Button)findViewById(R.id.btn1);
button[1] = (Button)findViewById(R.id.btn2);
button[2] = (Button)findViewById(R.id.btn3);
button[3] = (Button)findViewById(R.id.btn4);
button[4] = (Button)findViewById(R.id.btn5);
button[5] = (Button)findViewById(R.id.btn6);
for(int i = 0; i <4; i++){
if (button[i].getId() == v.getId()){
textView[x].setText(button[i].getText()); //x=0
button[i].setVisibility(View.INVISIBLE);
if(x<6)
x++;
}
}
for(int i = 0; i <6; i++){
if(button[i].getVisibility() == View.VISIBLE){
button[i].setEnabled(false);
}
}