Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I show a ProgressBar only after a minimum delay?

I have an AsyncTask with an indeterminate ProgressBar that typically executes very quickly, but occasionally slowly. It's undesirable and distracting to for the the progress bar to flash quickly when there is no discernible wait.

Is there a way to delay display of the progress bar without creating another nested AsyncTask?

like image 443
Jeff Axelrod Avatar asked Jul 21 '12 01:07

Jeff Axelrod


People also ask

What are the different types of progress bars?

There are 2 types of progress bars: determinate and indeterminate. The former is used when the amount of information that needs to be loaded is detectable. The latter is used when the system is unsure how much needs to be loaded or how long it will take.

Which is the method of progress bar?

Methods of Progress Bar setIndeterminate(boolean indeterminate)– It sets the progress bar to be either determinate or indeterminate. Passing 'true' means Indeterminate and passing 'false' means Determinate. setMax(int max_value)– It sets the maximum value of the progress in the progress bar.

What is ProgressBar indeterminate?

Android ProgressBar Indeterminate ProgressBar An indeterminate ProgressBar shows a cyclic animation without an indication of progress.


1 Answers

Yes, there is and it's called a CountDownTimer and its highly underused. You can take action at each tick of the timer or when the timer runs out.

like image 181
Code Droid Avatar answered Oct 18 '22 09:10

Code Droid