I want to change keyboard input ,
Example :
When user press a , it will be show c
I tried to use TextWatcher
and it hang because after calling setText
, it will be arrive again TextWatcher event. So, it will deadlock and not working.
setOnKeyListener
is not working also. onKey
event arrive when Enter. Not arriving when I press a or b.
It is possible to change text input key in EditText Android ?
Update: setOnKeyListener
final EditText edittext = (EditText) findViewById(R.id.editText1);
edittext.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View arg0, int keycode, KeyEvent event) {
// TODO Auto-generated method stub
Log.i("onKey", "Arrive Keypress");
if (event.getAction()!=KeyEvent.ACTION_DOWN)
return true;
if (event != null&& (keycode == KeyEvent.KEYCODE_ENTER)) {
applySearch();
return true;
}
return false;
}
});