Good I'm doing an application in android studio, and in a part I create several dynamic edittext according to an intent of the previous screen, and I would like to do it is that the start button, which starts another intent, will only be enabled when it is checked that all the edidtext are not empty. Every time an edittext is created it is entered into an arrayList so I thought I would use the contains function but it was not as good as it would be.
cant = Integer.parseInt(dato);
ScrollView layout = (ScrollView) findViewById(R.id.linearJugadores);
LinearLayout contenedor = new LinearLayout(this);
contenedor.setOrientation(LinearLayout.VERTICAL);
contenedor.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
final ArrayList<EditText> listaEdit = new ArrayList<EditText>();
for (int j = 1; j <= cant; j++ ){
EditText edit = new EditText(this);
TextView text = new TextView(this);
edit.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
edit.setId(j);
edit.setMinWidth(200);
text.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
text.setText("\nJugador " + j);
text.setId(j);
contenedor.addView(text);
contenedor.addView(edit);
listaEdit.add(edit);
}
Button bEmpezar = new Button(this);
bEmpezar.setText("Empezar partida");
bEmpezar.setBackgroundColor(R.color.colorNaranja);
bEmpezar.setTextColor(R.color.colorBlanco);
contenedor.addView(bEmpezar);