How do I know when the user has played outside EditText?

1

I need to identify when this happens.

I have two EditTexts, when the user types the hour and minute and tap another EditText to name example, I need a warning to appear in case the time is incorrect.

I have the function that checks the time and talz.

    
asked by anonymous 17.08.2017 / 13:58

1 answer

1

Using the onFocusChange method you might be doing this:

 editText.setOnFocusChangeListener(new OnFocusChangeListener() {          

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