ProgressDialog in AsyncTask: Dynamic Update max()

Posted by in Software

Sometimes you determine the max of the progress bar in the background task. Unfortunately, there’s almost no way to transmit that to an UI thread-executed method like onProgressUpdate() (well, you could, but that’d be abusing the method). Instead you can do something like:

This way, the variables are updated in their own thread and the progress is advanced with a percentage.

A little experiment: If you find this post and ad below useful, please check the ad out :-)