title: Show spinning wheel dialog while loading data on Android
body: <p>I want to show a spinning wheel dialog while my app loads some data:</p>
  
  <p><img src="https://i.stack.imgur.com/B8pAZ.png" alt="Spinning wheel dialog"></p>
  
  <p>The spinning wheel dialog should show on a button click. I’m using the code below but it does now show the spinning wheel. What could be the problem?</p>
  
  <pre><code>public void CheckAccount(String username, String password) {
      try {
  
          final ProgressDialog progDailog = ProgressDialog.show(this,
              "Progress_bar or give anything you want",
              "Give message like ....please wait....", true);
          new Thread() {
              public void run() {
                  try {
                      // sleep the thread, whatever time you want. 
                      sleep(1000);
                  } catch (Exception e) {
                  }
                  progDailog.dismiss();
              }
          }.start();
  
          //getting data code here
          //getting data code here
          //getting data code here
          //getting data code here
          //getting data code here
  
      } catch (Exception e) {
          Log.e(LOG_TAG, e.getMessage());
          PopIt("CheckAccountError", e.getMessage(), "Denied");
      }
  }
  </code></pre>