Jump to content

  • Log In with Google      Sign In   
  • Create Account


Getting keypresses from Keyboard


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 JohnnyLightwave   Members   -  Reputation: 142

Like
0Likes
Like

Posted 18 April 2012 - 08:33 AM

Hi all,

I want to pop up the keyboard on Android, and intercept keypresses to send them to my app (which is running on another thread).

I am working in the NativeSDK, with a Java helper.

On iPhone, I do this by making an offscreen text box, then giving it focus. I'm then able to hook a function to watch the keyboard, and get the keypresses before they go to the text box.

Is there anything equivalent on Android? I can't seem to make anything work... seems like I can't even put an offscreen text box with the GL Surface View I'm using. It seems like either the GL View, or the threading is messing me up-- does anyone have a nice simple methodology for accomplishing this? Really all I want to know is the char that was pressed on the keyboard, so I can push it into my own system.

Thanks for your help!
--John

Sponsor:

#2 frob   Moderators   -  Reputation: 20363

Like
0Likes
Like

Posted 18 April 2012 - 10:00 AM

You can always use onKeyDown and onKeyUp events. Those two are probably the most commonly used for games.
Check out my personal indie blog at bryanwagstaff.com.

#3 JohnnyLightwave   Members   -  Reputation: 142

Like
0Likes
Like

Posted 18 April 2012 - 10:09 AM

You can always use onKeyDown and onKeyUp events. Those two are probably the most commonly used for games.


Will those work with the onscreen keyboard as well? Or are those just for phones with a keypad?

#4 frob   Moderators   -  Reputation: 20363

Like
0Likes
Like

Posted 18 April 2012 - 10:27 AM

I believe it is generated for every keystroke, whether that comes from a hardware key or from an IME (software keyboard) key.

Also note that it isn't just phone keypads. Tablets can have full keyboards, some devices accept USB keyboards, and you can attach bluetooth keyboards to most devices. There are similar events for mice and pointing devices, if you are interested in those as well.
Check out my personal indie blog at bryanwagstaff.com.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS