Pausing and Resuming a count down timer and progress bar in android?
<blockquote>
  <p>I am making a simple app which uses a count down timer,Circular
  progress bar and 3 buttons start, Pause and Resume.What I am trying to
  do is when a particular activity starts and I press pause it stores
  the time at which the timer was paused and resume from that point
  forward.But the problem is the count down timmer doesn't stop so if I
  pause at say 7 sec the progress bar stops at 7sec but when I press
  resume it starts from whatever the count down timer value is at that
  moment.This is the code I am trying to implement.</p>
</blockquote>

<pre><code>  btnPause.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //When user request to pause the CountDownTimer
                isPaused = true;

                //Enable the resume and cancel button
                btnResume.setEnabled(true);
                //Disable the start and pause button
                btnStart.setEnabled(false);
                btnPause.setEnabled(false);
            }
        });



btnResume.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        //Disable the start and resume button

        btnStart.setEnabled(false);
        btnResume.setEnabled(false);
        //Enable the pause and cancel button
        btnPause.setEnabled(true);

        //Specify the current state is not paused and canceled.
        isPaused = false;
        isCanceled = false;
        mCountDownTimer.start();
}
    });
</code></pre>

<p>And this is code for the count down timer.</p>

<pre><code> private void neck_rotations()
    {
        neckRotation = true;
        mCountDownTimer = new CountDownTimer(NECK_ROTATION_TIME, 1000)
        {
            @Override
            public void onTick(long millisUntilFinished)
            {

                if (isPaused || isCanceled)
                {
                    paused_at = (int) (millisUntilFinished / 1000);

                } else
                {
                    timeRemaining = (int) (millisUntilFinished / 1000);
                    donutProgress.setMaxValue(NECK_ROTATION_TIME / 1000);
                    donutProgress.setValueAnimated((int) timeRemaining);
                    counter.setText(String.valueOf(timeRemaining));

                }

            }

            @Override
            public void onFinish()
            {
                response = "Jumps";
                rest(response);

            }
        };
        mCountDownTimer.start();
    }
</code></pre>

<p>I am new to programming so any help or suggestion is appreciated.Thank you.</p>