我试图检查文本框中的值是否在4到80之间,但我不能这样做,但它不是我需要的
final String checkage = age.getText().toString(); if(checkage.equals(4) || checkage.equals(80) ) { Toast.makeText(this, "You must be older than 4 and younger than 80", Toast.LENGTH_SHORT).show(); return; }
Mohammed Aou.. 5
用这个:
final String checkage = age.getText().toString(); int value = Integer.parseInt(checkage); if(value >= 4 && value <= 80) { Toast.makeText(this, "You must be older than 4 and younger than 80", Toast.LENGTH_SHORT).show(); return; }
' || 在这种情况下,'对你没用.
用这个:
final String checkage = age.getText().toString(); int value = Integer.parseInt(checkage); if(value >= 4 && value <= 80) { Toast.makeText(this, "You must be older than 4 and younger than 80", Toast.LENGTH_SHORT).show(); return; }
' || 在这种情况下,'对你没用.