Hi,

I am creating an application where in if the user pressed a button
then a key event will be send to a edit text. For example, if the user
pressed the button A, then the text A will be displayed in the edit
text.

I am using this code atm but am not sure whether it is correct way to
achieve it.

----------------------------------------------------------------------
EditText et = (EditText)findViewById(R.id.ageEditText);
KeyEvent key = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_0);
et.dispatchKeyEvent(key);

key = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_0);
et.dispatchKeyEvent(key);
----------------------------------------------------------------------

Any comments and better code snippets to achieve the objective is
welcome.

Thank you,
Soumya

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to