How can I know when an EditText loses focus?

Implement onFocusChange of setOnFocusChangeListener and there’s a boolean parameter for hasFocus. When this is false, you’ve lost focus to another control. EditText txtEdit = (EditText) findViewById(R.id.edittxt); txtEdit.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { // code to execute when EditText loses focus } } });