Hello all!
I am creating a game in which the user can control a ship by
- Using DPAD
- Using touchscreen
- Using trackball
- And even using orientation events (roll pitch etc)
It all works on the emulator but when i open the game on a real device
then
the events (touch, trackball) do not work anymore.
I am catching evetns by overriding the dispatch<EventType>() methods.
This is the code in my Activity class that catches the events:
public boolean dispatchKeyEvent(KeyEvent e) {
super.dispatchKeyEvent(e);
return controller.onKeyEvent(e.getKeyCode(), e);
}
public boolean dispatchTrackballEvent(MotionEvent e) {
if(settings[2] || settings[3]) {
return controller.onTrackballEvent(e);
} else {
return super.dispatchTrackballEvent(e);
}
}
public boolean dispatchTouchEvent(MotionEvent e) {
if(settings[1]) {
return controller.onTouchEvent(e);
} else {
return super.dispatchTouchEvent(e);
}
}
I think the dispatchKeyEvent(..) method works fine, but the other ones
do not work on a real device.
They work without problems on the emulator.
What am i doing wrong?
I really do not understand it.
Thanks in advance.
-
Tjerk Wolterink
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---