Skip to content Skip to sidebar Skip to footer

Android: Timer/delay Alternative

I want to make an image be visibile for 60 ms and then be invisible, then I want another image to do the same.. and so on. I don't think I'm using the Timer right.. because when I

Solution 1:

You can try to use Handler, it posts smth into UI thread, it can post with a delay postDelayed

Solution 2:

The problem is that both timers have a 60 ms delay and in the run method of both you set them to be visible. You need to change one of the run methods to set it to invisible.

Solution 3:

You are creating two events which both fire 60 ms from now.

You instead could set the first event to fire in 60ms and the second in 120ms, or have the first event trigger a submission of the second event 60ms from when the first runs.

Post a Comment for "Android: Timer/delay Alternative"