How to restart countdown timer progress bar animation?

Good Day everyone :) i need help for my quiz app, i am new in android ,my problem is how can i restart the animation of progress bar? every time i get the correct answer. the timer is already restarting each question with correct answer but the animation of progress bar is still running. i already research how to restart progress bar. all answer are much appreciated tnx and advance :) each question has 30 seconds countdown

and here is my progress timer code

public class QuestionActivity extends Activity {

MediaPlayer mySound;
List<Question> quesList;
int score = 0;
int qid = 0;
int i = 5;


ProgressBar mProgressBar;
CountDownTimer mCountDownTimer;

// Animation
Animation animFadein;


Question currentQ;
TextView txtQuestion, scored;
Button button1, button2, button3, button4,helpbtn;
/**
 * ATTENTION: This was auto-generated to implement the App Indexing API.
 * See https://g.co/AppIndexing/AndroidStudio for more information.
 */
private GoogleApiClient client;


public void help (View view){

    helpbtn=(Button)findViewById(R.id.helpbtn);
    helpbtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            String AnswerString = currentQ.getANSWER();

            //match DB answer to selected answer, turn it visible if it is correct
            if(button1.getText().equals(AnswerString)){
                button1.setBackgroundColor(Color.GRAY);
            } else if(button2.getText().equals(AnswerString)){
                button2.setBackgroundColor(Color.GRAY);
            } else if(button3.getText().equals(AnswerString)){
                button3.setBackgroundColor(Color.GRAY);
            } else if(button4.getText().equals(AnswerString)){
                button4.setBackgroundColor(Color.GRAY);
            }

            //eliminate 2 button
            // button1 .setVisibility(View.INVISIBLE);
            // button2 .setVisibility(View.INVISIBLE);
            // button3 .setVisibility(View.INVISIBLE);
            // button4 .setVisibility(View.INVISIBLE);

        }
    });
}
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_qestion);
    QuizHelper db = new QuizHelper(this);  // my question bank class
    quesList = db.getAllQuestions();  // this will fetch all questions
    currentQ = quesList.get(qid); // the current question
    mySound = MediaPlayer.create(this, R.raw.bensoundcute); // music background
    mySound.start();
    mySound.setLooping(true);

    txtQuestion = (TextView) findViewById(R.id.txtQuestion);
    // load the textQuestion animation
    animFadein = AnimationUtils.loadAnimation(getApplicationContext(),
            R.anim.fade_in);
    // the text view in which the question will be displayed
    // the 4 buttons,
    // the idea is to set the text of 4 buttons with the options from question bank
    button1 = (Button) findViewById(R.id.button1);
    button2 = (Button) findViewById(R.id.button2);
    button3 = (Button) findViewById(R.id.button3);
    button4 = (Button) findViewById(R.id.button4);

    // the text view in which score will be displayed
    scored = (TextView) findViewById(R.id.score);
    // method which will set the things up for our game

    setQuestionView(false);

    mProgressBar = (ProgressBar) findViewById(progressbar);
    mProgressBar.setProgress(i);
    mProgressBar.setMax(100);
    mProgressBar.setIndeterminate(false);

    mCountDownTimer = new CountDownTimer(30000,299) {
            @RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
            @Override
            public void onTick(long millisUntilFinished) {
                Log.v("Log_tag", "Tick of Progress" + i + millisUntilFinished);
                i++;
                mProgressBar.setRotation(180);
                mProgressBar.setProgress(i);
            }
            @Override
            public void onFinish() {
                Toast.makeText(getApplicationContext(), "TIME is UP!", Toast.LENGTH_SHORT).show();
                Intent intent = new Intent(QuestionActivity.this,
                        ResultActivity.class);
                // passing the int value
                Bundle b = new Bundle();
                b.putInt("score", score); // Your score
                intent.putExtras(b); // Put your score to your next
                startActivity(intent);
                mCountDownTimer.cancel();
                finish();
            }
    };
        txtQuestion.setAnimation(animFadein);
        txtQuestion.startAnimation(animFadein);
        mCountDownTimer.start();
    // button click listeners
    final MediaPlayer buttonSound = MediaPlayer.create(this, R.raw.play);
    button1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            buttonSound.start();
            // passing the button text to other method
            // to check whether the answer is correct or not
            // same for all three buttons
            getAnswer(button1.getText().toString());

        }
    });
    button2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            buttonSound.start();
            getAnswer(button2.getText().toString());

        }
    });
    button3.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            buttonSound.start();

            getAnswer(button3.getText().toString());

        }
    });
    button4.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            buttonSound.start();
            getAnswer(button4.getText().toString());

        }
    });
    // ATTENTION: This was auto-generated to implement the App Indexing API.
    // See https://g.co/AppIndexing/AndroidStudio for more information.
    client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
@Override
protected void onPause(){
    super.onPause();
    mySound.release();
    finish();
}
@Override
public void onBackPressed() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setCancelable(false);
    builder.setMessage("Do you want to Exit?");
    builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            //if user pressed "yes", then he is allowed to exit from application
            dialog.dismiss();
            onYesClick();
        }
        private void onYesClick() {
            Intent setIntent = new Intent(Intent.ACTION_MAIN);
            setIntent.addCategory(Intent.CATEGORY_HOME);
            setIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(setIntent);
            mCountDownTimer.cancel();
            finish();
            QuestionActivity.this.finish();
        }
    });
    builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            //if user select "No", just cancel this dialog and continue with app
            dialog.cancel();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}
public void getAnswer(String AnswerString) {
    //If timer is running stop and restart
    if(mCountDownTimer != null) {
        mCountDownTimer.cancel(); // Stop Timer
        mCountDownTimer.start(); // Start timer
    }
    if (currentQ.getANSWER().equals(AnswerString)) {
         // if conditions matches increase the int (score) by 1
         // and set the text of the score view
        //Intent intent = new Intent(this, QuestionActivity.class);
        //startActivity(intent);
        Toast.makeText(getApplicationContext(), "CORRECT!", Toast.LENGTH_SHORT).show();
        score++;
        scored.setText("Score:  " + score + " /100");
        txtQuestion.setAnimation(animFadein);
        txtQuestion.startAnimation(animFadein);
        mProgressBar.setProgress(0);
        mCountDownTimer.cancel();

    }
    else {
        // if unlucky start activity and finish the game
        Toast.makeText(getApplicationContext(),
                "Sorry! Better luck next time.",
                Toast.LENGTH_SHORT)
                .show();
        Intent intent = new Intent(QuestionActivity.this,
                ResultActivity.class);
        // passing the int value
        Bundle b = new Bundle();
        b.putInt("score", score); // Your score
        intent.putExtras(b); // Put your score to your next
        setQuestionView(false);
        startActivity(intent);
        mCountDownTimer.cancel();
        finish();
    }
    if(qid < 100) {
        // if questions are not over then do this
        currentQ = quesList.get(qid);
        setQuestionView(true);
        txtQuestion.setAnimation(animFadein);
        txtQuestion.startAnimation(animFadein);

         button1 .setBackgroundColor(Color.WHITE);
         button2 .setBackgroundColor(Color.WHITE);
         button3 .setBackgroundColor(Color.WHITE);
         button4 .setBackgroundColor(Color.WHITE);
    }
    else {
        // if unlucky start activity and finish the game
        Toast.makeText(getApplicationContext(),
                "Game Over.",
                Toast.LENGTH_SHORT)
                .show();
        Intent intent = new Intent(QuestionActivity.this,
                ResultActivity.class);
        // passing the int value
        Bundle b = new Bundle();
        b.putInt("score", score); // Your score
        intent.putExtras(b); // Put your score to your next
        startActivity(intent);
        mCountDownTimer.cancel();
        finish();
    }
}
private boolean setQuestionView(boolean b) {
    // the method which will put all things together

    txtQuestion.setText(currentQ.getQUESTION());
    button1.setText(currentQ.getOPTA());
    button2.setText(currentQ.getOPTB());
    button3.setText(currentQ.getOPTC());
    button4.setText(currentQ.getOPTD());

    qid++;
    return b;
}


ANSWERS:


Once if the answer is correct set your progress bar degree to zero. Apply this line, once if the answer was correct.

mProgressBar.setRotation(0);


It looks like you mean that you want to reset the progress. In that case, call mProgressBar.setProgress(0). Also don't forget to cancel the timer by calling mCountDownTimer.cancel().



 MORE:


 ? How to restart countdown timer progress bar animation?
 ? Circular Progress Bar ( for a countdown timer )
 ? Circular Progress bar / PIE for countdown timer
 ? Countdown Progress Bar not working Android
 ? Circle progress bar with countdown
 ? How to cancel countdown timer with progress bar in android?
 ? Android studio pause and resume countdown timer for progress bar
 ? Android Studio: Progress Bar without thread or multiprocessing
 ? Android Studio: Progress Bar without thread or multiprocessing
 ? Android Studio: Progress Bar without thread or multiprocessing