Thursday, November 18, 2010

Threads in Android - ProgressDialog showing up all late

If you need to display a progress bar and its not showing up and your code done executing, then you need to learn threads. You have to execute your long running code in a sperate thread (downloading data, saving user perferences, i.e., any long running process). However, you cannot update the UI in your new thread. You will have to create a 'Handler' and post messages from your new thread. The handler will hand the message off to the UI/calling thread. I learned all of this from here: simple progress bar dialog in android with thread