Events not catched on real device using Activity.dispatch<EventType>

by TjerkW » Sun, 12 Apr 2009 20:20:45 GMT

Sponsored Links
 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
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) {
                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


Other Threads

1. Mediastore Thumbnails not generated until Gallery app is launched ?

Is that normal that Images indexed in the MediaStore do not have
thumbnails generated until the Gallery app is launched and the user
actively navigates to the bucket where the image is stored ?

I think it's quite odd as I thought thulbnails generation was part of
media indexing.


2. Golf App for Android

Could someone provide me a link on a good Golf application on android?
I am interested to look at the screenshots and its flow.
Wonder if we are able to find out elevation and/or wind speed through
a device. Is it possible with any of the phones in the market running
on android?

3. documentation issue

4. download layoutlib.jar

5. record and store the recording to remote server

6. Sharing YM id, lagiii...

7. Sending large files through webservice