title: Problem to stop thread due to progress dialog
body: <p>I have two buttons: one for start an execution of function as given below with thread and progress dialog </p>
  
  <pre><code> start_button.setOnClickListener(new View.OnClickListener() {
                  public void onClick(View v) {
                      Log.d(TAG, "mMainButton clicked");
  
                      showLoading();
                      // Calling showdialog before downloading..   
                      Thread t = new Thread(){      
                          public void run() {                  
                              startdownload();
  
                              // Code for download....                 
                              // After download UI thread will call    
                              runOnUiThread(new Runnable() {            
  
                                  public void run() {        
                                      dialog.cancel();     
                                      alertbox("Info","Download Completed");     
                                      }                
                                  });             
                              }};           
                              t.start();                                                      
                  }
              });
  
  public ProgressDialog dialog;    
          public  void showLoading () {       
              // prepare the dialog box       
              //ProgressDialog            
              dialog = new ProgressDialog(this);           
              // make the progress bar cancelable       
              dialog.setCancelable(true);            
              // set a message text            
              dialog.setMessage("Please wait while Downloading.."); 
              // show it            
              dialog.show();            
              } 
          protected void alertbox(String title, String mymessage)    {   
              new AlertDialog.Builder(this)       
              .setMessage(mymessage)       
              .setTitle(title)      
              .setCancelable(true)       
              .setNeutralButton("OK",          
                      new DialogInterface.OnClickListener() 
              {               
                  public void onClick(DialogInterface dialog, int whichButton){}  
              })       .show();  
              } 
  
      public Boolean startdownload() {    
  
              try
              {
              downloadhelper = new download_helper(this);
  
              downloadhelper.DownloadProblemAndReasonCode();      
  
              pkManifest=downloadhelper.DownloadNewManifest();        
  
              downloadhelper.DownloadNewMessages();
  
              //downloadhelper.DeleteOldManifest();
  
  
              }
              catch(Exception exception)
              {
                  exception.toString();
              }
              return false;
          }
  </code></pre>
  
  <p>And another button to stop the download as given below:</p>
  
  <pre><code>stop_button.setOnClickListener(new View.OnClickListener() {
              public void onClick(View v) {           
                  onStop();
                  MessageBox("Down Load Stopped");                
  
              } 
  
          });
  
  public void onStop() {
          super.onStop();
          isRunning = false;
  
  
              }
  </code></pre>
  
  <p>The problem is that I am not able to click button to stop the started function due to the progress dialog that comes in front.</p>
  
  <p>Is there any way to stop the execution of the start button function clicked?</p>