I have validation for editText
. If the editText
field is empty it should fail validation and stop the user moving on to another Activity
,
It's easy...check if your EditText is empty as in below example below.
if( TextUtils.isEmpty(userName.getText())){
/**
* You can Toast a message here that the Username is Empty
**/
userName.setError( "First name is required!" );
}else{
Intent i = new Intent(getApplicationContext(), Login.class);
startActivity(i);
}