我有这几行代码来验证表单输入。但是,它不输出任何东西 - 只是一个空白框。请问我错过了什么?
public void onClick(View view)
{
if( view.getId() == R.id.btnLogin )
{
TestClass.setUsername( txtUserName.getEditableText().toString() );
TestClass.setPassword( txtPassword.getEditableText().toString() );
if( TestClass.getUsername().toString().length() == 0 )
{
this.txtUserName.setError( "Incorrect input!" );
}
else if( TestClass.getPassword().toString().length() == 0 )
{
this.txtPassword.setError( "Incorrect input!" );
}
else
{
// do the login stuff here
}
}
}