android 验证文本框是否输入字符的方法

    txtpwd=(EditText)findViewById(R.id.txtPassword);     
     if (TextUtils.isEmpty(txtpwd.getText().toString()))
     {
         new AlertDialog.Builder(this)
            .setMessage("请输入系统密码!")
            .setPositiveButton("确定",
                            new DialogInterface.OnClickListener(){
                                    public void onClick(DialogInterface dialoginterface, int i){
                                     setResult(RESULT_OK);
                                    }
                            })
            .show();

     }

posted on 2011-03-18 09:35  唐朝  阅读(623)  评论(0编辑  收藏  举报