i'm developing a game where i want to move a car based on the DPAD navigation buttons. i'm using the onKeyDown() to capture the events for left, right, up and down. the problem is that on the actual G1, where the DPAD is replaced by a trackball, the left and right actions are not detected. only the up and down events are registered. some of the books mention that android automatically maps the trackball events to DPAD events if the onTrackBallEvent() is not overridden. this doesnt seem to be happening in my code. following is the code of the onKeyDown() method:
public boolean onKeyDown(int key, KeyEvent kc){ switch (key){ case KeyEvent.KEYCODE_DPAD_LEFT: isLeft = true; currentCar = 1; break; case KeyEvent.KEYCODE_DPAD_RIGHT: isRight = true; currentCar = 2; break; case KeyEvent.KEYCODE_DPAD_UP: SPEED = Math.min(30, SPEED + 10); break; case KeyEvent.KEYCODE_DPAD_DOWN: SPEED = Math.max(10, SPEED - 10); break; default: return super.onKeyDown(key, kc); } return true; } the whole thing runs fine on the emulator if i use the DPAD keys ... but on an actual device (and the trackball option in the emulator) the left and right options dont work. since the up and down options work in all cases, i dont think its a problem with view having focus. any help would be greatly appreciated. ~thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---