Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Progress Bar Listener

Is there anyway to know when a progressbar has reached it maximum. Like a Listener then could plug into the ProgressBar and lets us know that the progress bar is at the maximum level ?

Kind Regards

like image 509
AndroidDev Avatar asked Aug 06 '26 12:08

AndroidDev


1 Answers

There isn't a direct way to do this. A workaround could be to make a custom implementation of the ProgressBar and override the setProgress method:

public MyProgressBar extends ProgressBar
{
   @Override
   public void setProgress(int progress)
   {
       super.setProgress(progress);
       if(progress == this.getMax())
       {
           //Do stuff when progress is max
       }
   }
}
like image 54
Leon Lucardie Avatar answered Aug 09 '26 03:08

Leon Lucardie