Android : Smooth Progress Bar with both decrements and increments
<p>I want a progress bar that decreases with time(sort of countdown timer) and increases if the user hits the correct button . A sample can be found out at the link: <a href="http://rainbowrex.herokuapp.com/" rel="nofollow">Rainbow Rex</a>. This is the kind of progress bar that I am looking for.</p>

<p>I have tried AsyncTask and threads and they do work for a smooth progress bar but cannot increase the progress on correct user click. Please help!
        public class ShowCustomProgressBarAsyncTask extends AsyncTask {</p>

<pre><code>    int myProgress;

    @Override
    protected void onPreExecute() {
        myProgress = 50;
    }

    @Override
    protected Void doInBackground(Void... params) {
        while(myProgress&gt;=0){
            myProgress--;
            publishProgress(myProgress);
            SystemClock.sleep(200);
        }
        return null;
    }

  @Override
    protected void onProgressUpdate(Integer... values) {
        customProgress.setProgress(values[0]);
   }
</code></pre>