title: android - progress bar is not dismissed properly
body: <p>In <code>OnResume()</code>, I make web service call in thread here i used progress bar for indicating the process it works fine but suppose i uses the app after sometime i put the device idle after that open the app once again this time progress bar is not dismissed.It's not regularly happens sometimes it happens. Why?<br>
  How can i make it to away from this? If you need more info plz let me know.</p>
  
  <p><strong>Code :</strong></p>
  
  <p><strong>Edit:</strong></p>
  
  <pre><code>public void onResume()
  {
  
      super.onResume();
      pdMessages = ProgressDialog.show(getParent(), "", "Please wait...", true);
              Thread thImportbtn = new Thread() 
              {
                  public void run() 
                  {
                      try
                      {
                          //Get internal messages
                          strInternalInboxWSR = GetInternalInboxMessages();
  
  
                      } catch (SoapFault e) {
                          e.printStackTrace();
                      }   
  
                      dh_Messages_Handler.post(checked_internalinbox_response);
                      handler.sendMessage(handler.obtainMessage());
                  }                                               
              };
              thImportbtn.start();       
  }
  </code></pre>
  
  <p>private Handler handler = new Handler()
  {</p>
  
  <pre><code>@Override
  public void handleMessage ( Message message )
  {
      pdMessages.dismiss();
  }
  </code></pre>
  
  <p>};</p>