Loading Dialog is not being displayed

Discussion in 'Application Development' started by wige, Feb 12, 2010.

  1. wige

    wige Well-Known Member

    Oct 28, 2009
    Director of IT
    Pennsylvania, USA
    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 (Text):
    2. // Show the loading dialog
    3. //progressDialog = ProgressDialog.show(this, "", "Loading. Please wait...", true);
    4. progressDialog = new ProgressDialog(this);
    5. progressDialog.setMessage("Loading. Please wait...");
    6. progressDialog.show();
    8. // Create a thread to update the report
    9. updateThread = new UpdateThread(this.username, this.password, reportID, this);
    10. 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?


Share This Page