0
案例:
我在問用戶問題的答案是7
。驗證EditText輸入並更新用戶分數
我如何驗證EditText
的條目是7,之後我想給他們的得分1分。
//Question #1
//If Answer is equal to 7 than award One Point
int = score;
private EditText questionOneAnswer;
EditText text = (EditText) findViewById(R.id.Part2Question1);
String EditText = text.getText().toString().trim();
if(EditText.isEmpty() || EditText.length() == 0 ||
EditText.equals("7") || EditText == null)
{
//EditText is empty
}