判断输入的文字是否为空
来源:互联网 发布:网络数据拦截分析工具 编辑:程序博客网 时间:2024/04/30 03:49
1、
仅仅是举例
//验证用户信息private void commitInfo() { if (Util.isEmpty(userName.getText().toString())) { CLToastUtil.showToast(ServiceRegistration.this, "您还没有输入姓名"); } else if (Util.isEmpty(companyName.getText().toString())) { CLToastUtil.showToast(ServiceRegistration.this, "您还没有输入公司名称"); } else if (Util.isEmpty(companyAddress.getText().toString())) { CLToastUtil.showToast(ServiceRegistration.this, "您还没有输入公司地址"); } else if (Util.isEmpty(qualitylabel.getText().toString())) { CLToastUtil.showToast(ServiceRegistration.this, "您还没有输入公司性质标签"); } else if (Util.isEmpty(productServer.getText().toString())) { CLToastUtil.showToast(ServiceRegistration.this, "您还没有输入公司产品服务"); } else if (Util.isEmpty(companyProfile.getText().toString())) { CLToastUtil.showToast(ServiceRegistration.this, "您还没有输入公司简介"); } else { // }}2、
对字符串的判断
public static boolean isEmpty(String s) { if (null == s) return true; if (s.length() == 0) return true; if (s.trim().length() == 0) return true; if(s.equals("0")) return true; return false;}3、
对Toast的封装
public class CLToastUtil { private static Toast toast; public static void showToast(Context context,String text){ if(toast == null){ toast = Toast.makeText(context, text, Toast.LENGTH_SHORT); } toast.setText(text); toast.show(); } public static void showToast1(Context context,String text){ if(toast == null){ toast = Toast.makeText(context, text, Toast.LENGTH_LONG); } toast.setText(text); toast.show(); }}
0 0
- 判断输入的文字是否为空
- js判断输入框的值是否为空
- JS判断表单输入是否为空
- js判断输入框是否为空
- JS判断表单输入是否为空
- 判断输入信息是否为空
- js判断表单输入是否为空
- JS判断输入是否为空
- javascript判断输入是否为空
- js判断输入是否为空
- 判断输入为空是否闪退
- 判断输入的信息是否为空,如果为空,提示信息
- js关于输入内容是否为空,以及输入数字,时间,长短是否正确的判断
- Javascript中判断输入的字符串是否为空?是否为数值?去掉首尾空格
- 判断是否为空
- 判断是否为空
- 判断是否为空
- android、Java下判断两个String是否相等 、EditText输入是否为空,限定输入数字的实现 总结
- myeclipse 启动tomcat: XXX does not exist or is not a readable directory
- Qt实现天气预报与PM2.5监测系统(5)天气预报接口
- Oracle中命名块之存储过程的简单使用
- Android 唯一标识
- bzoj1053 [HAOI2007] 反素数ant
- 判断输入的文字是否为空
- sprintf() sscanf()的使用
- 让Excel工作簿中宏自动运行的两种方法
- PyCharm集成开发环境配合nginx搭建部署环境
- mac上安装gdb及使用中碰到的问题
- 关于头文件和命名空间
- 4558: [JLoi2016]方
- c++-静态成员函数和非静态成员函数的区别
- Remove Linked List Elements