Reputation: 67
what's the correct inputType
for email
in EditText?
<EditText
android:id="@+id/email"
android:layout_width="200dip"
android:layout_height="wrap_content"
android:layout_below="@+id/textEmail"
android:inputType=""/>
Upvotes: 6
Views: 9057
Reputation: 11
ticketMail1 = findViewById(R.id.ticketMail);
private boolean validateEmail(EditText email){
String emailinput = ticketMail1.getText().toString();
if(!emailinput.isEmpty() && Patterns.EMAIL_ADDRESS.matcher(emailinput).matches()){
return true;
}else{
Toast.makeText(this,"Invalid Email Address",Toast.LENGTH_SHORT).show();
return false;
}
}
Upvotes: 0
Reputation: 93668
You don't need one, the default is fine. You only need an input type when you want special behavior- numeric only, password, things like that.
Edit: if you want an email address, then use textEmailAddress as others suggested. The body of an email, which is how I read the question, can be default. Subject has textEmailSubject, but tends to be ignored.
Upvotes: 3
Reputation: 8747
android:inputType="textEmailAddress"
If you hit Ctrl + Space in Eclipse then it will bring up the menu of options available and narrow them down as you type.
Upvotes: 10