1 if(name_a.getText().toString().trim().equals("")){
2 new AlertDialog.Builder(ActivityA.this)
3 .setTitle("警告").setMessage("姓名输入不能为空,请重新输入!!!")
4 .setPositiveButton("确定", null).show();
5 return;
6 
7 }else{
8 age_a.setText(age_a.getText().toString());
9 }

在layout中对于EditText只能输入数字的方法:

android:numeric="integer"
android:singleLine="true"

相关文章:

  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
  • 2021-04-29
  • 2021-11-15
  • 2021-07-07
  • 2021-08-19
猜你喜欢
  • 2022-01-11
  • 2021-08-22
  • 2021-09-21
  • 2022-12-23
  • 2021-09-11
  • 2021-10-31
  • 2021-11-10
相关资源
相似解决方案