How can I validate my fields (eg: name, email, mobile).
I validated whether the fields are empty but I don't know how to check whether the format is valid or not
My code:
public void btnClick(View v)
{
EditText name = (EditText) findViewById(R.id.signup_name);
EditText email= (EditText) findViewById(R.id.signup_email);
EditText phone= (EditText) findViewById(R.id.signup_phone);
if(name.getText().length()==0)
{
name.setError("Field cannot be left blank.");
}
else if (email.getText().length()==0){
email.setError("Field cannot be left blank.");
}
else if (phone.getText().length()==0){
phone.setError("Field cannot be left blank.");
}
}