我想向用户显示一些不同的消息,用于他们所做的不同长度的输入。但是我的代码不起作用。这是怎么回事?
EditText boxID = findViewById(R.id.vcInput);
Button button = findViewById(R.id.refresh);
TextView tv = findViewById(R.id.message)
final int inputLength = boxID.getText().toString().length();
if(inputLength >= 10 && inputLength <= 11)
{tv.setText("Refresh request sent");}
else if(inputLength<1)
{tv.setText("VC number field looks empty");} //Only this one works at any input length
else if(inputLength>1 && inputLength<10)
{tv.setText("VC number must be at least 10 digit");}
else {tv.setText("Wrong input");}
慕姐8265434
GCT1015
摇曳的蔷薇
相关分类