Bruce Lee Bruce Lee - 1 year ago 133
Android Question

How to remove a runnable from a handler object added by postDelayed?

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 question is, how would I cancel the "close" animation in the handler?


Answer Source

Just use the removeCallbacks(Runnable r) method.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download