title: AsyncTask and Looper.prepare() crash on every 6th call
body: <p>i have an issue with looper.prepare() in doInBackground(). if i donot use looper.prepare it generates an exception "Can't create handler inside thread that has not called Looper.prepare()" and when i use looper.prepare it works fine for 5 calls to looper.prepare and on sixth call it generates following exception.</p>
  
  <pre><code>08-15 11:29:48.078: W/System.err(14133): java.lang.RuntimeException: Only one Looper may be created per thread
  08-15 11:29:48.088: W/System.err(14133):    at android.os.Looper.prepare(Looper.java:74)
  08-15 11:29:48.088: W/System.err(14133):    at the.bike.washer.SelectLocation$setUserCurrentLocation.doInBackground(SelectLocation.java:1504)
  08-15 11:29:48.088: W/System.err(14133):    at the.bike.washer.SelectLocation$setUserCurrentLocation.doInBackground(SelectLocation.java:1)
  08-15 11:29:48.088: W/System.err(14133):    at android.os.AsyncTask$2.call(AsyncTask.java:264)
  08-15 11:29:48.088: W/System.err(14133):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
  08-15 11:29:48.088: W/System.err(14133):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
  08-15 11:29:48.088: W/System.err(14133):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
  08-15 11:29:48.088: W/System.err(14133):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
  08-15 11:29:48.088: W/System.err(14133):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
  08-15 11:29:48.088: W/System.err(14133):    at java.lang.Thread.run(Thread.java:856)
  </code></pre>
  
  <p>Here is the code </p>
  
  <pre><code>try {
                  Looper.prepare();
                  locationManager = (LocationManager) context
                          .getSystemService(LOCATION_SERVICE);
  
                  // getting GPS status
                  isGPSEnabled = locationManager
                          .isProviderEnabled(LocationManager.GPS_PROVIDER);
  
                  // getting network status
                  isNetworkEnabled = locationManager
                          .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
  
                  if (!isGPSEnabled &amp;&amp; !isNetworkEnabled) {
                      // no network provider is enabled
                      double lat = 48.8742;
                      double lng = 2.3470;
                      Constants.coordinates = new LatLng(lat, lng);
                      Constants.address = getFromLocation(lat, lng, 1);
                      result = "no gps";
                  } else {
                      //this.canGetLocation = true;
                      if (isNetworkEnabled) {
                          locationManager.requestLocationUpdates(
                                  LocationManager.NETWORK_PROVIDER,
                                  MIN_TIME_BW_UPDATES,
                                  MIN_DISTANCE_CHANGE_FOR_UPDATES, SelectLocation.this);
                          Log.d("Network", "Network");
                          if (locationManager != null) {
                              location = locationManager
                                      .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
                              if (location != null) {
                                  latitude = location.getLatitude();
                                  longitude = location.getLongitude();
                                  Constants.coordinates = new LatLng(latitude, longitude);
                                  Constants.address = getFromLocation(latitude, longitude, 1);
                              }
                          }
                      }
                      // if GPS Enabled get lat/long using GPS Services
                      if (isGPSEnabled) {
                          if (location == null) {
                              locationManager.requestLocationUpdates(
                                      LocationManager.GPS_PROVIDER,
                                      MIN_TIME_BW_UPDATES,
                                      MIN_DISTANCE_CHANGE_FOR_UPDATES, SelectLocation.this);
                              Log.d("GPS Enabled", "GPS Enabled");
                              if (locationManager != null) {
                                  location = locationManager
                                          .getLastKnownLocation(LocationManager.GPS_PROVIDER);
                                  if (location != null) {
                                      latitude = location.getLatitude();
                                      longitude = location.getLongitude();
                                      Constants.coordinates = new LatLng(latitude, longitude);
                                      Constants.address = getFromLocation(latitude, longitude, 1);
                                  }
                              }
                          }
                      }
                  }
  
              } catch (Exception e) {
                  e.printStackTrace();
              }
  </code></pre>