Search code examples
javaandroidandroid-edittext

Disable @ char in EditText


I have the following sign up the layout in my application:

enter image description here

I found out that for some reason users sometimes insert in the Name field their email and then instead of their name the email is shown in the application.

I had like to avoid this situation and to disable the @ char in this EditText or more generally I don't want them to write their email there.

How can I do it?

I don't mind them inserting anything else including chars/numbers/symbols/any language.

Thank you


Solution

  • To my mind, it's better to have a field validation when the user clicks on the Login button instead of « blocking » the user when writing data.

    Doing this, you can display an error message to warn the user.