android - How to display toast when changing focus in EditText? -


i working on login page of activity have username , password 2 edittext boxes. trying display toast message when focus changed username password box : -if text entered in username box has whitespace in it. -if no white space no toast display.

edittext txtedit = (edittext) findviewbyid(r.id.edittxt);   txtedit.setonfocuschangelistener(new onfocuschangelistener() {                    public void onfocuschange(view v, boolean hasfocus) {             if (!hasfocus) {                if (txtedit.gettext().contains(" ")) {                  toast.maketext(context, text, toast.length_short).show();             }         }     }); 

reference: https://stackoverflow.com/a/10627231/2111834


Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -