Change Action Of 'done' Button On Virtual Keyboard Android
All- I looked at other questions relating to this topic and found out that according to the android development website: 'the action key performs a 'done' operation, typically mean
Solution 1:
Best possible way
Example for handling Enter key event
publicvoidonCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txt = (EditText)findViewById(R.id.txt);
txt.setOnKeyListener(newOnKeyListener() {
@OverridepublicbooleanonKey(View v, int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN)
{
Log.d(TAG, "enter_key_called");
}
returnfalse;
}
});
}
Post a Comment for "Change Action Of 'done' Button On Virtual Keyboard Android"