I have an EditText
. On a setOnKeyListener
of an EditText
, I want to perform the following action.
On click of the Done button of the keyboard, I want to display something in my
TextView
.On click of other buttons, not the done button, I want to make the
TextView
blank.
So for that, I write the code but it works for the click of a done button but not for other buttons. so can anyone help me to solve this out?
My Code
EditText.setOnKeyListener(new OnKeyListener()
{
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER))
{
m_passwrdErrorText.setText(m_res.getString(R.string.passwrd_error_text));
}
else
{
m_passwrdErrorText.setText("");
}
return false;
}
});