How do I know when the user touched outside of Edittext?

Asked

Viewed 42 times

1

I need to identify when this happens.

I have two Edittexts, when the user type the time and minute and tap another Edittext example name, I need to appear a warning if the time is incorrect.

I have the function that checks the time and Talz.

  • Probably some focuslost event, must have something like that for the field.

  • 1

    Take a look here: https://stackoverflow.com/a/10627231/5524514

1 answer

1


Using the method onFocusChange Voce may be doing this feature:

 editText.setOnFocusChangeListener(new OnFocusChangeListener() {          

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
               Toast.makeText(getContext, "Saiu do EditText", Toast.LENGTH_LONG).show();
            }
        }
    });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.