I have this code on the click event of a button. When i click on the button i want to show a progress dialog while on the very next line a new thread is created that data from the server . I call the dismiss method on the above variable from within the tread to dismiss the dialog. The problem is i have found that the dialog dose not run straight afaw but only after the thread completes does the dialog box start showing. How i can i fix this ?
Progress bar counting is implemented using thread (second thread) using Handler.
This example uses a second thread to track the progress of a process (which actually just counts up to 100). The thread sends a Message back to the main Activity through a Handler each time progress is made. The main Activity then updates the ProgressDialog.
View this Example and click on Example ProgressDialog with a second thread. this will help you.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads