title: Return value from child thread
body: <p>I'm writing an Android app that communicates with a website.  Any time I hit the website, I'm displaying a ProcessDialog so that the user knows something's happening.  Most of my website communication is one-way, so I don't usually expect any return data.</p>
  
  <p>There is one point however where I need to get information back, but the results are not being stored when I exit the child thread.  In a nutshell, I need to call a thread, let it process the results, and store the results in a couple of fields.</p>
  
  <p>Here's what I've got so far - I have two variables, <code>String[] Account</code> and <code>boolean AccountRetrievalSuccess</code>:</p>
  
  <pre><code>public void GetAccount() {
      MyDialog = ProgressDialog.show( MyContext, "Retrieving Account" , "We're retrieving your account information. Please wait...", true);
      Thread T = new GetAccountThread();
      T.start();
  }
  
  public class GetAccountThread extends Thread {
     @Override
      public void run() {
         try {
             String resp = GetPage(BaseURL+MainPage+"?P="+PhoneID+"&amp;K="+WebAccessKey+"&amp;A=ACCOUNT");
             if (resp.contains("FAILURE|")){
                 failhandler.sendEmptyMessage(0);
             } else {
                 resp = resp.replace("SUCCESS|", "");
                 Account = resp.split("\\|");
                 handler.sendEmptyMessage(0);
              }
         } catch (Exception e) {
             failhandler.sendEmptyMessage(0);
         }
      };
  
      private Handler handler = new Handler() {
          @Override
          public void handleMessage(Message msg) {
              AccountRetrievalSuccess = true;
              MyDialog.dismiss();
          }
      };
  
      private Handler failhandler = new Handler() {
          @Override
          public void handleMessage(Message msg) {
              AccountRetrievalSuccess = false;
              MyDialog.dismiss();
              ShowWtf();
          }
      };
  }
  </code></pre>
  
  <p>Any idea what I'd need to do to be able to store the Account and AccountRetrievalSuccess values so that I can access them from elsewhere in the code?</p>