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. Ho to write files to internal or external cache directory?


I want to write my cache files into external cache directory. But I
can't to create cache path

I check that external storage exists
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
 File path = new File(this.getExternalCacheDir(), "");
 String s=path.getPath();
 // result -> s= /mnt/sdcard/Android/data/;
 // than I want to create full path and get false.
 Boolean bmkdirs=path.mkdirs();

I have permission  in manifest <uses-permission

What's wrong? Hot to solve this issue?


2. Sha Sanyo Zio

Ditunggu ripiuwnya kang upi
On Feb 22, 2011 6:57 PM, "Lutfi Hidayat Ramdhani" <


3. Trouble with bluetooth pairing my Samsung Galaxy Tablet with my PC

4. Ada yang Jual Samsung Nexus S....?

5. Handling orientation changes with an Alarm

6. Upgrade O1

7. desire Z