Android service - check if variable asynchronously changes over period of time?
<p>Let's say I have a boolean isAction. In my service I want to run some sort of timer mechanism and if this boolean changes state, call some function X, else do nothing. </p>

<p>What would be the best way to do this? I've tried using timers to no avail, and I'm not sure if a handler with postDelayed would be appropriate to do this, since the boolean could change states back-and-forth, which may give me a "false-positive" of isAction never changing.  </p>

<p>For more background info, an intent gets fired which starts a service. This service needs to determine if boolean isAction stays the same for about a second or so, and if it does, then take some action, else return and do nothing. </p>

<p>Thanks. </p>
