开发者

How do I temporarily disable/bypass the Android OnTouchEvent

开发者 https://www.devze.com 2023-01-18 07:23 出处:网络
I\'m currently using the event @Override public boolean onTouchEvent(MotionEvent ev) { To provide feedback from the user for game I\'m writing.This event fires off some game control events that tak

I'm currently using the event

@Override
public boolean onTouchEvent(MotionEvent ev)
{

To provide feedback from the user for game I'm writing. This event fires off some game control events that take some time to complete (because there is animation involved). The problem I'm having is during the animation if I keep 开发者_C百科touching the screen (AKA firing this event), I will get a timeout error:

10-02 21:58:30.776: ERROR/ActivityManager(67): Reason: keyDispatchingTimedOut

Basically while the animation is running, I do not need this event, although it would be nice to queue it.

What can I do to prevent the timeout and either queue the event, or temporarily disable it?

Thanks.


Are you by any chance blocking the UI thread? There should be absolutely no reason to do what you are asking for (and it's not even possible :)


Beside what Romain said.
You might want to sleep() on your onTouchEvent.

0

精彩评论

暂无评论...
验证码 换一张
取 消