title: Asynctask crashes, can't find reason
body: <p>I have this Asynctask that is supposed to calculate the location of the user. The code inside the Asynctask works fine outside Asynctask, so I know that my error is at arranging the Asynctask, which I am very unfamiliar with.</p>
  
  <p>Asynctask is ran by this line inside an onClick method:</p>
  
  <pre><code>new GetCurrentCity().execute();
  </code></pre>
  
  <p>And here is GetCurrentCity itself:</p>
  
  <pre><code>    private class GetCurrentCity extends AsyncTask&lt;String, Void, String&gt;{
  
  
  
      @Override
      protected String doInBackground(String... args) {
          locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
          Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
          double longitude = location.getLongitude();
          double latitude = location.getLatitude();
  
  
              Geocoder gcd = new Geocoder(getApplicationContext(), Locale.getDefault());
              try {
                  List&lt;Address&gt; addresses = gcd.getFromLocation(latitude, longitude, 1);
                  if(addresses != null) {
                      Address returnedAddress = addresses.get(0);
  
                      for(int i=0; i&lt;returnedAddress.getMaxAddressLineIndex(); i++) {
                     strReturnedAddress = (returnedAddress.getAddressLine(i)).toString();
          }
                  }
              }
  
                      catch (IOException e) {
                          e.printStackTrace();
                      }
  
          return strReturnedAddress;
      }
          protected void onPostExecute(String useless2){
              test.setText(strReturnedAddress);
          }
          }
  </code></pre>
  
  <p>As I have said I am a total newbie with different threads, so please excuse me if this is a very easy question.</p>
  
  <p>Also, I am still severely struggling with parameters, so I feel like the problem is with them; yet, I have tried everything I could think of before coming here to ask.</p>
  
  <p>Thank you in advance, and have a good day! </p>
  
  <p>Edit: this is the current logcat</p>
  
  <pre><code>07-10 20:24:08.175: D/OpenGLRenderer(15827): Enabling debug mode 0
  07-10 20:24:08.435: I/TextToSpeech(15827): Connected to ComponentInfo{com.google.android.tts/com.google.android.tts.GoogleTTSService}
  07-10 20:24:13.460: W/dalvikvm(15827): threadid=13: thread exiting with uncaught exception (group=0x41471930)
  07-10 20:24:13.465: E/AndroidRuntime(15827): FATAL EXCEPTION: AsyncTask #3
  07-10 20:24:13.465: E/AndroidRuntime(15827): java.lang.RuntimeException: An error occured while executing doInBackground()
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at android.os.AsyncTask$3.done(AsyncTask.java:299)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at java.util.concurrent.FutureTask.run(FutureTask.java:239)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at java.lang.Thread.run(Thread.java:856)
  07-10 20:24:13.465: E/AndroidRuntime(15827): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at android.os.Handler.&lt;init&gt;(Handler.java:197)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at android.os.Handler.&lt;init&gt;(Handler.java:111)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at android.location.LocationManager$ListenerTransport$1.&lt;init&gt;(LocationManager.java:197)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at android.location.LocationManager$ListenerTransport.&lt;init&gt;(LocationManager.java:197)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at android.location.LocationManager.wrapListener(LocationManager.java:820)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at android.location.LocationManager.requestLocationUpdates(LocationManager.java:833)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at android.location.LocationManager.requestLocationUpdates(LocationManager.java:430)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at com.example.realapptest1.MainActivity$GetCurrentCity.doInBackground(MainActivity.java:306)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at com.example.realapptest1.MainActivity$GetCurrentCity.doInBackground(MainActivity.java:1)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
  07-10 20:24:13.465: E/AndroidRuntime(15827):    ... 4 more
  </code></pre>