One work-around works rather well if you do the onTouchEvent handling
in the main GUI-thread and drawing the screen in another (background)
thread.

In your handling of your onTouchEvent (especially when handling the
ACTION_MOVE) add a sleep statement for about 20 milliseconds (or a bit
longer) (try { Thread.sleep(20); } catch (Execption e) {}). Try other
values (more than 20 millisecs, but no more than 100).

This is an *ugly* solution, but it does throttle down the onTouchEvent
and give other threads a better chance to run more smoothly.


On Apr 27, 12:24 am, piecewise <[email protected]> wrote:
> I've got a problem with a flood of touch events destroying my game's
> framerate while there is a touch active.
>
> Basically onTouchEvent is called (with getAction = ACTION_MOVE, x = 0
> and y = 0) about a hundred times a second for as long as the finger is
> touching the screen. I've tried returning from onTouchEvent straight
> away, and even removing its implementation at all, but it doesn't help
> - the app slows to a crawl as soon as a finger is down.
>
> I asked on the IRC channel and Romain Guy advised me that they're
> aware of the problem but didn't have time to fix it for Cupcake, so
> I'm not expecting a full solution!
>
> I was just wondering if anyone else has encountered this and figured
> out a way around it.
>
> Cheers,
> Tom
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to