Search code examples
javaandroidandroid-edittextmouseclick-event

Disable clickevent after edittext clicked in android


There is one edittext view which users should enter valid e-mail address.Click handler automaticly adds allowed domain "@stackoverflow.com". I mean if u click the edittext program java sets the text as @stackoverflow.com and users enter their id like [email protected]

Problem is if u type wrong character and click again to edittext it set the text again @stackoverflow.com

Example [email protected] but you want to type [email protected] u click the edittext to fix but it is @stackoverflow.com again.

How to disable second,third... click event but enable only first click event?

Why cant i set the text without click event? Because i cant show the hint text if i do that.


Solution

  • Add verification by clicking

     if (youEditText.getText().toString().isEmpty()) {
            //insert domain "@stackoverflow.com
        }