title: Unable To Call Task Within A Thread
body: <p>I am trying to display multiple pin locations on the map i.e. my location and another location I get from the cloud server.</p>
  
  <p>Based on the code below:</p>
  
  <p>I keep getting a NullPointer Error message when I try to tokenize my string.  This implies that my CloudTask activity is never fired....  I can't figure out why and the Eclipse Debugger won't step through the threads...any help is appreciated.</p>
  
  <pre><code>    public class MapsActivity extends com.google.android.maps.MapActivity {
      private static final String TAG = null;
  
  
      private MapController mapController;
      private MapView mapView;
      private LocationManager locationManager;
      private MyOverlays itemizedoverlay;
      private MyLocationOverlay myLocationOverlay;
      private MyLocationOverlay otherLocationOverlay;
      private Handler handler;
  
      private String message;
      StringTokenizer tokens;
  
      Integer p1 = null;
      Integer p2;
  
      GeoPoint point;
      static Context mContext = null;
  
      public void onCreate(Bundle bundle) {
          super.onCreate(bundle);
          setContentView(R.layout.main); // bind the layout to the activity
  
  
              // Configure the Map
              mapView = (MapView) findViewById(R.id.mapview);
              mapView.setBuiltInZoomControls(true);
              mapView.setSatellite(true);
              mapController = mapView.getController();
              mapController.setZoom(14); // Zoon 1 is world view
              locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
  
  
              locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 2500,
                      0,(LocationListener) new GeoUpdateHandler());
                      //new Intent("android.intent.action.LOCATION_CHANGED"); 
                      //(LocationListener) new GeoUpdateHandler());
  
              myLocationOverlay = new MyLocationOverlay(this, mapView);
  
  
              mapView.getOverlays().add(myLocationOverlay);
  
  
              handler = new Handler();
          //  new AsyncTask&lt;Void, Void, String&gt;() {
              myLocationOverlay.runOnFirstFix(new Runnable(){ 
               public void run(){
  
  
  
                      MyRequestFactory requestFactory = Util.getRequestFactory(mContext,
                              MyRequestFactory.class);
                      final CloudTask1Request request = requestFactory.cloudTask1Request();
                      Log.i(TAG, "Sending request to server");
  
  
                      request.queryTasks().fire(new Receiver&lt;List&lt;TaskProxy&gt;&gt;() {
  
  
                          @Override
                          public void onSuccess(List&lt;TaskProxy&gt; taskList) {
                              //message = result;
  
  
                              message = "\n";
  
                              for (TaskProxy task : taskList) {
  
                                  message += task.getId()+","+task.getNote()+",";                                 
  
                              }
  
  
                          }
                      });
                      //return message;
                  //}
  
  
  
                          if(message.length() == 0){
  
                              Log.i("MESSAGE","Did not get any points from cloud");
                          }
  
                      tokens = new StringTokenizer(message,",");
  
  
                       tokens.nextToken();
                       p1 = Integer.parseInt(tokens.nextToken());
                       p2 = Integer.parseInt(tokens.nextToken());
                       point = new GeoPoint(p1,p2);
  
                       mapView.getController().animateTo(point);
  
  
          }
  
  
      });
  
               Drawable drawable = this.getResources().getDrawable(R.drawable.pushpin);
                  itemizedoverlay = new MyOverlays(this, drawable);
                  createMarker();
  
              myLocationOverlay.runOnFirstFix(new Runnable() {
                  public void run() {
                      mapView.getController().animateTo(
                              myLocationOverlay.getMyLocation());
                  }
              });
  
              //Drawable drawable = this.getResources().getDrawable(R.drawable.pushpin);
              itemizedoverlay = new MyOverlays(this, drawable);
              createMarker();
  
  
      }
  
  
  
  
      @Override
      protected boolean isRouteDisplayed() {
          return false;
      }
  
      public class GeoUpdateHandler implements LocationListener {
  
          @Override
          public void onLocationChanged(Location location) {
              int lat = (int) (location.getLatitude() * 1E6);
              int lng = (int) (location.getLongitude() * 1E6);
              GeoPoint point = new GeoPoint(lat, lng);
              createMarker();
              mapController.animateTo(point); // mapController.setCenter(point);
  
          }
  
          @Override
          public void onProviderDisabled(String provider) {
          }
  
          @Override
          public void onProviderEnabled(String provider) {
          }
  
          @Override
          public void onStatusChanged(String provider, int status, Bundle extras) {
          }
  
  
      }
  
      private void createMarker() {
          GeoPoint p = mapView.getMapCenter();
          OverlayItem overlayitem = new OverlayItem(p, "", "");
          itemizedoverlay.addOverlay(overlayitem);
          if (itemizedoverlay.size() &gt; 0) {
              mapView.getOverlays().add(itemizedoverlay);
          }
      }
  
      @Override
      protected void onResume() {
          super.onResume();
          myLocationOverlay.enableMyLocation();
          myLocationOverlay.enableCompass();
      }
  
      @Override
      protected void onPause() {
          super.onResume();
          myLocationOverlay.disableMyLocation();
          myLocationOverlay.disableCompass();
      }
  
  
  } 
  </code></pre>