• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Loading Dialog is not being displayed

wige

Newbie
I am creating an app that allows the user to send a request to a web server to create an update. Between the request being sent, and a response being received from the server, I want to display a loading message to the user. I have tried several methods to accomplish this, the latest being using a thread to handle the server communication, with a call to display the loading dialog before the start of the thread. In no case have I been able to get it to work. The code I am using is here:

Code:
// Show the loading dialog
//progressDialog = ProgressDialog.show(this, "", "Loading. Please wait...", true);
progressDialog = new ProgressDialog(this);
progressDialog.setMessage("Loading. Please wait...");
progressDialog.show();
                
// Create a thread to update the report
updateThread = new UpdateThread(this.username, this.password, reportID, this);
updateThread.run();

The above code is in an Onclick method, being called when a button is pressed. progressDialog is a ProgressDialog, and updateThread is a private internal class.

Also, if I omit the updateThread.run() line, so the application just hangs instead of running the thread, the loading message will display. However, if I actually run the thread, no dialog.

Any thoughts or suggestions?
 
Back
Top Bottom