edit_Text.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
Toast.makeText(getApplicationContext(), "got the focus", Toast.LENGTH_LONG).show();
iv.setVisibility(View.GONE);
}else
Toast.makeText(getApplicationContext(), "lost the focus", Toast.LENGTH_LONG).show();
iv.setVisibility(View.VISIBLE);
}
});
source
share