title: android - reset progress bar on back pressed button
body: <p>Since android 5.0 api 22 I have a problem on my app.</p>
  
  <p>I have an activity called "time progress" (its not my main activity). On that activity I have a chronometer with a circular progress bar, so the time goes from 15 to 0 and progress bar is filling up.</p>
  
  <p>When I click on back button to go to the main menu and then I go again to the "time progress" my progress bar its not empty (has some value, like 15 or 3 or 8, random values) and I want the progress bar empty.</p>
  
  <p>I tried onstop(); flag_activity_no_history, flag_activity_new_task, flag_activity_clear_top, set progressbar to 0 but nothing works.</p>
  
  <p>Here is my code</p>
  
  <pre><code>int j = 0;
  public void timetest() {
      CountDownTimer countdown = new CountDownTimer(15000, 1000) {
      TextView timetext = (TextView) findViewById(R.id.timetext);
      ProgressBar progresstime = (ProgressBar) findViewById(R.id.progresstime);
         @Override
         public void onTick(long millisUntilFinished) {
            timetext.setText(Long.toString(millisUntilFinished / 1000));
            j = j + 1;
            progresstime.setProgress(j);
        }
      }
        @Override
        public void onFinish() {
           playtime.setText("Time's up");
       }
     }.start();
    }
  @Override
  public void onBackPressed() {
      Intent backmainmenu = new Intent(getBaseContext(), MainActivity.class);
      startActivity(backmainmenu);
    }
  </code></pre>
  
  <p>Should start always like this: <a href="http://postimg.org/image/62ledzapp" rel="nofollow">Image1</a></p>
  
  <p> And not like this: <a href="http://postimg.org/image/6te4jrd31" rel="nofollow">Image2</a></p>
  
  <p>Maybe I applied those functions in the wrong way :/ .</p>
  
  <p>Any help please ?</p>
  
  <p>thanks</p>