Sunday, March 27, 2011

Re: [android-developers] Re: How to capture key events from View subclass

Thanks Pepijn, 

I am overriding onCreateInputConnection (and onCheckIsTextEditor) although neither of these give me per-keytap events - from what I have read, onKeyDown/Up only give per-keytap event signals on hard keyboards, not soft.

I did find out about the TextWatcher class from http://www.mail-archive.com/android-developers@googlegroups.com/msg10100.html . You can attach it with the addTextChangedListener(TextWatcher watcher) method of TextView.  But I have yet a different problem with this;  I get events per tap on the keyboard 
when subclassing EditText, but not TextView (and the exact same code, just changing what I subclass).  But, EditText brings alot of baggage that I don't want, like the current position marker, etc.  Anyone know why this would be?

On Thu, Mar 24, 2011 at 11:44 PM, Pepijn Van Eeckhoudt <pepijn@vaneeckhoudt.net> wrote:
I've never done this myself, but from reading the InputMethodManager documentation I get the impression you need to override View#onCreateInputConnection(EditorInfo) in order to directly interact with an IME.
Might be worth a shot...

Pepijn


On 24/03/2011 13:26, Rich E wrote:

On Tue, Mar 22, 2011 at 6:14 PM, harsh chandel <harshdchandel@gmail.com> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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

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

No comments:

Post a Comment