Correct the IME does not send you raw keyboard events.  It may not even
*have* raw keyboard events.  Consider a handwriting IME, for example.  That
is why the interaction with it is through InputConnection.  Every
interaction you can have with the IME is basically through InputConnection.

Note that on a soft keyboard, it *will* make calls on to InputConnection for
each key pressed, to tell you about the text that should now be shown.

On Sun, Mar 27, 2011 at 2:24 AM, Rich E <[email protected]> wrote:

> Harsh, this doesn't make any sense.  You are suggesting that implementing
> onKeyDown will cause onTouchEvent to receive touches from the keyboard? That
> is not right. Also, the touches are not in my view, they are in the global
> keyboard.
>
> From what I have found in other posts, onKeyDown/Up does not fire when
> pressing individual keys on the soft keyboard, only for the hard.  Why this
> is so is unclear to me, but that is what I am experiencing.
>
> The only solution I have found so far is not a favorable one, subclass
> EditText and call 
> addTextChangedListener<http://developer.android.com/reference/android/widget/TextView.html#addTextChangedListener(android.text.TextWatcher)>
>  with
> my own TextWatcher.
>
> On Thu, Mar 24, 2011 at 11:49 PM, harsh chandel 
> <[email protected]>wrote:
>
>> ok you have to write the code for on key down
>> and each time the key is pressed on soft keyboard you capture the event
>> and do whatever you  want to do with on press event
>> @Override
>>    public boolean onTouchEvent(MotionEvent event) {
>>        if (event.getAction() == MotionEvent.ACTION_DOWN) {
>>            _active = false;
>>        }
>>
>>  this was what i was talking about
>>
>>
>> On Thu, Mar 24, 2011 at 5:56 PM, Rich E <[email protected]> wrote:
>>
>>>
>>> On Tue, Mar 22, 2011 at 6:14 PM, harsh chandel 
>>> <[email protected]>wrote:
>>>
>>>> try ontouch method
>>>> get x and y coordinate   of the area clicked
>>>> and do as you want on the clicked event
>>>>
>>>>
>>> harsh chandel, I am not sure that I understand you.. I am using
>>> onTouchEvent() to trigger the keyboard (imm.showSoftInput() code in my last
>>> post)... but I cannot get the pressed keys of the keyboard.  As it is not my
>>> keyboard (it is the system shared keyboard), I cannot re-implement any
>>> onTouchEvent method that it may hold, unless I am missing something in your
>>> suggestion.
>>>
>>> There must be some event that I need to listen to (onKeyUp for the soft
>>> keyboard keys..), but I don't yet know how.
>>>
>>> Thanks for the help,
>>> Rich
>>>
>>
>>
>  --
> 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
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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