title: Android progress dialog while getting data from sqlite
body: <p>I tried to implement threads, asynctask from examples on the web but none of them run the way I want.</p>
  
  <p>I have a class to send data to a web server.
  It contains 3 tasks:
  -grab an id 
  -get data from sql and build a json file
  -send the json file</p>
  
  <p>I'd like to implement a progress dialog or progressbar to show progress to the user waiting.</p>
  
  <p>The progressdialog I last tested to show data grabbing from sqlite was based on <a href="http://eagle.phys.utk.edu/guidry/android/progressBarExample.html" rel="nofollow">Progress Bar Example</a>.
  Trouble is that when I try to generate my file more than 2 times, the thread is not starting...</p>
  
  <p>So whats's the best to be done in my case ?
  I have a spinner to select what to send and a button to send.</p>
  
  <p>When button is clicked, basically I have:</p>
  
  <pre><code>HttpResponse response = GetChantier(commentaire);
      //Checking response 
      if( response != null)
      {
          String _response=EntityUtils.toString(response.getEntity());
          int chantier_serveur = Integer.parseInt(_response.replaceAll("[\n\r]", ""))
          String fichier = DonneesToJson(db,chantier, chantier_serveur);
          HttpResponse response = SendJson ( chantier, fichier);
      }
  </code></pre>
  
  <p>I'd need to implement a progress for DonneesToJson and SendJson.</p>
  
  <p>DonnesToJson grabs a cursor then build a json file while iterating the cursor.
  SendJson is an HttpPost that sends a file and 2 fields.</p>
  
  <p>I'm really new to java programming and threads.
  Any help appreciated.</p>
  
  <p>Regards.</p>