views:

73

answers:

1

Hi,

I have an "open" animation and am using Handler.postDelayed(Runnable, delay) to trigger a "close" animation after a short delay. However, during the time between open and close, there is possibly another animation triggered by a click...my question is, how would I cancel the "close" animation in the handler?

Thanks

+2  A: 

Just use the removeCallbacks(Runnable r) method.

Cristian
Is it possible to remove callbacks for anonymous runnables?
Bruce Lee
I don't think so... you will have to use non-anonymous ones. Otherwise you won't be able to reference them in the future.
Cristian