我在android中有5个编辑文本供用户输入数字并保存。我想知道我是否可以使用一种方法来检查是否有任何已编号的编辑文本,下一个数字显示另一个编辑文本,但每次它覆盖第一个编辑文本值时,请告诉我如何检查编辑文本框不是空白和数字显示另一个编辑文本。
number1=(EditText)findViewById(R.id.editText1);
number2=(EditText)findViewById(R.id.editText2);
number3=(EditText)findViewById(R.id.editText3);
number4=(EditText)findViewById(R.id.editText4);
number5=(EditText)findViewById(R.id.editText5);
Intent i=getIntent();
Bundle bundle = getIntent().getExtras();
String number = i.getStringExtra("Number");
Log.e("international", "number1"+number);
if((number1.getText().toString().equals("")))
{
number1.setText(number);
Log.e("international", "number1"+number);
}
else if ((!number1.getText().toString().equals("")) && number2.getText().toString().equals(""))
{
number2.setText(number);
Log.e("international", "number2"+number);
}
else if ((number1.getText().length()!=0) && (number2.getText().length()!=0) && number3.length()==0 )
{
number3.setText(number);
Log.e("international", "number3"+number);
}else if (number1.length()!=0 && number2.length()!=0 && number3.length()!=0 && number4.length()==0 )
{
number4.setText(number);
}else if (number1.length()!=0 && number2.length()!=0 && number3.length()!=0 && number4.length()!=0 && number5.length()==0 )
{
number5.setText(number);
}else
{
number3.setText(number);
Log.e("international else...", "number3"+number);
}