How to poll hardware button states

NeoTechni

Well-Known Member
Licensed User
Longtime User
If I were to say, make a game. I can't rely on the events, I'd have to poll each button's status with a timer.

How would I do so?
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
There is no way to poll buttons status. You will need to use the events.

Dang. Cause there aren't events for the button being released, or still being held. And this is an important thing to make games, that makes the opengl libraries worthless without it
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
You should be able to use my Gestures library to detect press and release on any View. I've just tried it on a button and it seems fine. The only problem will be that when you start the gesture on a view it will keep receiving gesture data until you lift off, even if the gesture leaves the the view. A bit of logic could solve this.

You could also use Panels or areas within a Panel to simulate buttons, again using the Gestures library.
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
Is the D-pad in the SDK ? if it is could it be checked using the reflection library?
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
Its just 4 hardware buttons

As I understand it, these are mapped as part of a hardware keyboard (probably as cursor keys). There must be a way of getting the keystate from the KeyboardActionListener using the reflection library.

If you are in an EditText what effect does pressing these buttons have? do they repeat?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…