Sreekanth Karumanaghat
Sreekanth Karumanaghat

Reputation: 3403

Email keyboard for edit text

The following Code doesn't seem to work,I want the email keyboard with @ and .com to get displayed for the edit text.

emailEditText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);

Upvotes: 44

Views: 29950

Answers (3)

Aydın Ahmed
Aydın Ahmed

Reputation: 579

In Kotlin way:

email_field.valueEditText.inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS

Upvotes: 1

Sreekanth Karumanaghat
Sreekanth Karumanaghat

Reputation: 3403

Well I found the solution which is to use

emailEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);

Upvotes: 78

agamov
agamov

Reputation: 4427

Add this to your layout:

android:inputType="textEmailAddress"

Upvotes: 92

Related Questions