[android-developers] Re: Android keyevent keycodes and scancodes

2009-11-18 Thread Mark Wyszomierski
Hi, If we need to check if a particular key was pressed, is this the correct way of doing it?: public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_O) { alert(you pressed the 'o' key!); } else if (keyCode == KeyEvent.KEYCODE_R) {

Re: [android-developers] Re: Android keyevent keycodes and scancodes

2009-11-18 Thread Dianne Hackborn
That tells you about events being delivered to the specific view(s) you have the listener attached to. You also need to look in the event to see if it is an up or down. This only tells you about events when one of the views has focus. On Wed, Nov 18, 2009 at 8:49 AM, Mark Wyszomierski

Re: [android-developers] Re: Android keyevent keycodes and scancodes

2009-11-18 Thread Yi Sun
yi...@yisun-desktop:~/android/x86/1029/frameworks/base$ find . -name KeycodeLabels.h ./include/ui/KeycodeLabels.h yi...@yisun-desktop:~/android/x86/1029/frameworks/base$ This is for Donut. I did not check for Eclair yet. On Fri, Nov 13, 2009 at 7:36 AM, Android_n00b nikhil...@gmail.com wrote:

[android-developers] Re: Android keyevent keycodes and scancodes

2009-11-18 Thread Mark Wyszomierski
Thanks Dianne, works well. On Nov 18, 12:45 pm, Dianne Hackborn hack...@android.com wrote: That tells you about events being delivered to the specific view(s) you have the listener attached to.  You also need to look in the event to see if it is an up or down.  This only tells you about events

Re: [android-developers] Re: Android keyevent keycodes and scancodes

2009-11-18 Thread Yi Sun
Please do pay attention to Dianne's comment, the mapping is per-device based. On Wed, Nov 18, 2009 at 9:55 AM, Yi Sun beyo...@gmail.com wrote: yi...@yisun-desktop:~/android/x86/1029/frameworks/base$ find . -name KeycodeLabels.h ./include/ui/KeycodeLabels.h

[android-developers] Re: Android keyevent keycodes and scancodes

2009-11-18 Thread Mark Wyszomierski
Hi Yi, If I understand correctly, does this just mean that a physical key may not appear at all on different devices? For instance, I want to check if the z key is pressed, so right now I check for: keyCode == KeyEvent.KEYCODE_Z if I understand correctly, KEYCODE_Z should be constant on all

[android-developers] Re: Android keyevent keycodes and scancodes

2009-11-13 Thread Android_n00b
Hi Yi, I am looking for the KeycodeLabels.h files in /android/frameworks/base/ libs/ui because that is where it is supposed to be, but I cannot find it. I see the KeyLayoutMap.h file but do not see the KeycodeLabels file. I am looking at online versions of the source code file structure and do

Re: [android-developers] Re: Android keyevent keycodes and scancodes

2009-11-13 Thread Dianne Hackborn
The mapping tables are device-specific. On Fri, Nov 13, 2009 at 7:36 AM, Android_n00b nikhil...@gmail.com wrote: Hi Yi, I am looking for the KeycodeLabels.h files in /android/frameworks/base/ libs/ui because that is where it is supposed to be, but I cannot find it. I see the KeyLayoutMap.h

[android-developers] Re: Android keyevent keycodes and scancodes

2009-11-11 Thread Android_n00b
I would really appreciate a reply from someone at Google if nobody can answer this. I really need to know this to move ahead with my project. Thanks. On Nov 11, 2:12 pm, Android_n00b nikhil...@gmail.com wrote: Hi I am writing a program which captures the keys pressed by user in android and

Re: [android-developers] Re: Android keyevent keycodes and scancodes

2009-11-11 Thread Mark Murphy
Android_n00b wrote: I would really appreciate a reply from someone at Google if nobody can answer this. I really need to know this to move ahead with my project. You will need to find the answer in the source code somewhere, most likely. Visit http://source.android.com, or perhaps use Google

Re: [android-developers] Re: Android keyevent keycodes and scancodes

2009-11-11 Thread Yi Sun
The EventHub.cpp calls the KeyLayoutMap.cpp to cover the real scan code to the Android internal keycode mapping. The internal key code mapping can be found in KeycodeLabels.h and KeyEvent.java. On Wed, Nov 11, 2009 at 11:34 AM, Android_n00b nikhil...@gmail.com wrote: I would really appreciate a

Re: [android-developers] Re: Android keyevent keycodes and scancodes

2009-11-11 Thread Dianne Hackborn
On Wed, Nov 11, 2009 at 11:34 AM, Android_n00b nikhil...@gmail.com wrote: I would really appreciate a reply from someone at Google if nobody can answer this. I really need to know this to move ahead with my project. Um, sorry it took me more than 20 minutes to respond to your post. :p The

[android-developers] Re: Android keyevent keycodes and scancodes

2009-11-11 Thread Android_n00b
Thanks a lot guys. Dianne, I didn't mean to be rude, I just wanted an answer from someone at Google, instead of anyone else. because I have posted a similar message in a bunch of forums and got different replies! Thanks again guys, I shall look into this. I was wondering whether there was any

Re: [android-developers] Re: Android keyevent keycodes and scancodes

2009-11-11 Thread Dianne Hackborn
The scan codes for 'a' and 'A' are the same, too. Key codes and scan codes represent physical buttons, not the textual result. On Wed, Nov 11, 2009 at 12:23 PM, Android_n00b nikhil...@gmail.com wrote: Thanks a lot guys. Dianne, I didn't mean to be rude, I just wanted an answer from someone at