0

I want to check wheteher the countdown is already running or not. If the countdown is running then it didn't start counting again. if it didn't counting then start counting.

So this application is similiar with onLocationChanged in GoogleMaps API. When my location is changing and outside of radius that i had already declared it in, it start countdown.

But while still countdown, my current location is changing into inside radius of i had declared in then the count down aborted.

Lets assuming i'm using googleMaps API so give me the example with onLocationChanged method.

What makes me confusing is onLocationChanged is always updating. So i didn't know how to resolve it yet.

Leonard Febrianto
  • 964
  • 2
  • 12
  • 37

2 Answers2

0

Use Handlers to Schedule a runnable which increments a count every second(Countdown Timer).

Use PostDelay and RemoveCallback to start and stop countdown

Keep a boolean to maintain the state of the countdown.

0

use a simple boolean variable. if you have to, put its getter/setter in a synchronized method

MobileMon
  • 8,341
  • 5
  • 56
  • 75