title: Android additional threads and Looper
body: <p>I am writing a Android application which reads data from a <code>SQLite Database</code> and then displays the data on a next screen. Whenever I was doing a query on the database I would get an error message that too much work is being done on the main thread.</p>
  
  <p>I then put my query in a new Thread:</p>
  
  <pre><code>        (new Thread()
          {
              public void run()
              {
                  Looper.prepare();
                  try
                  {
                      FPJobCardWizard data = dbHelperInstance.loadFPJobCardWizardFull(fitmentHash);
                      wState.fitmentItemSet(data.fitmentItemGet());
                  } catch (Exception e) {e.printStackTrace();}
                  Looper.loop();
              }
          }).start();
  </code></pre>
  
  <p>Now the gui/main thread is completing it's operation prior to the Query being complete and as a result the <code>data</code> variable is still empty. I read a few posts and the API documentation and it seems that I need to use a <code>Looper</code> (this seems to be the correct fix) but I have never used a Looper and cannot seem to get it to work.</p>
  
  <p>Please can you check the code above and guide me in the right direction.</p>
  
  <p>Thank you all in advance.</p>