title: Why can't I update my EditText in onPostExecute with Geocoder in the AsyncTask?
body: <p>I am trying to reverse geocode inside an <code>AsyncTask</code> to get the address of the current location. I want to set the <code>EditText</code> to the address as default when starting the activity. My problem is I am unable to do this in <code>onPostExecute()</code>, however, I can do it in <code>runOnUiThread()</code> inside <code>doInBackground()</code>. Why is this?</p>
  
  <p>AsyncTask:</p>
  
  <pre><code>protected String doInBackground(Void ...params) {
      Geocoder geocoder = new Geocoder(AddSpot.this, Locale.getDefault());
      List&lt;Address&gt; addresses = null;
      try {
          // Call the synchronous getFromLocation() method by passing in the lat/long values.
          addresses = geocoder.getFromLocation(currentLat, currentLng, 1);
      }
      catch (IOException e) 
      {
          e.printStackTrace();
      }
      if (addresses != null &amp;&amp; addresses.size() &gt; 0)
      {
          Address address = addresses.get(0);
          // Format the first line of address (if available), city, and country name.
          final String addressText = String.format("%s, %s, %s",
                  address.getMaxAddressLineIndex() &gt; 0 ? address.getAddressLine(0) : "",
                  address.getLocality(),
                  address.getCountryName());
          System.out.println(addressText);
          return addressText;
      }
      return null;
  }
  protected void onPostExecute(String address) { 
      EditText addrField=(EditText)findViewById(R.id.addr);
      addrField.setText(address);
  }
  </code></pre>
  
  <p>That does not work. However, when I stick a <code>runOnUiThread</code> in it, it works:</p>
  
  <pre><code> if (addresses != null &amp;&amp; addresses.size() &gt; 0)
                  {
                      Address address = addresses.get(0);
                      // Format the first line of address (if available), city, and country name.
                      final String addressText = String.format("%s, %s, %s",
                              address.getMaxAddressLineIndex() &gt; 0 ? address.getAddressLine(0) : "",
                              address.getLocality(),
                              address.getCountryName());
  
                      runOnUiThread(new Runnable()
                      {
                          @Override
                          public void run()
                          {
                              EditText addrField=(EditText)findViewById(R.id.addr);
                              addrField.setText(addressText); 
                          }
                      });
                      System.out.println(addressText);
                      return addressText;
                  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>After some debugging it appears that onPostExecute is never called at all no matter what I do. </p>
  
  <p>Things I have tried:</p>
  
  <ul>
  <li>Log information inside onPostExecute: Does not appear</li>
  <li>Remove the entire logic inside doInBackground so it's like this <code>return "hello"</code> : onPost still does not execute</li>
  </ul>