checking for variable changes within a specified amount of time?
<p>I'm trying to check for variable changes within a specified amount of time. For example I got a variable:
int downloadProgress = 0;</p>

<p>and I got some code which downloads a file and the var downloadProgress is being update to 1..2.3....5.6..7. until ..100 (download finishes).</p>

<p>Now I want to have a thread like the following:</p>

<pre><code>Runnable checkNet = new Runnable(){
    public void run(){
        // check variable changes
    }
};
</code></pre>

<p>that checks for changes in the variable downloadProgress within a specified amount of time say 20 seconds. If the variable doesn't change for at least 20 seconds than I want to do something! </p>

<p>How could I utilize a timer to do this within a thread!!</p>
