Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reset seekbar to beginning on back activity

Tags:

android

I have a seekbar in my activity. In the button event when I go to another activity and then use back button, the values of the seekbar are set where the user left it. I would like to reset the seekbar when the user comes back to the seekbar activity. How can I achieve it? Thanks

public void onClick(View v) {
    if (seek.getProgress > 0) {
        // do something
    }
}
like image 377
artist Avatar asked Dec 02 '25 01:12

artist


1 Answers

simply reset the seek bar in onPause or onResume of your SeekBarActivity, i.e. :

@Override
protected void onPause() {
    seek.setProgress(0);
    super.onPause();
}

This will be called when you have started another activity and the current one is paused.

like image 83
kiruwka Avatar answered Dec 03 '25 14:12

kiruwka