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:
public class MyTask