public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    global_app = (SupervisorApplication) getApplication();
    decimalFormat = new DecimalFormat("#.########");

    setContentView(R.layout.layout_default_map);
    searchButton = (Button) findViewById(R.id.search);
    searchButton.setOnClickListener(this);
    searchButton.setOnTouchListener(this);
    logo = (Button) findViewById(R.id.logo);
    logo.setOnClickListener(this);
    logo.setOnTouchListener(this);

    lastLocation = global_app.getLastLocation();
    // Log.d(TAG, "lastLocation: LAT: " + Double.toString(lastLocation.getLatitude()) + " LON: " +
    // Double.toString(lastLocation.getLongitude()));

    userMarker = getResources().getDrawable(R.drawable.me);
    currentMarker = getResources().getDrawable(R.drawable.current_marker);
    pendingMarker = getResources().getDrawable(R.drawable.pending_marker);
    doneMarker = getResources().getDrawable(R.drawable.done_marker);
    cancelMarker = getResources().getDrawable(R.drawable.cancel_marker);

    try {
      taskId = getIntent().getExtras().getLong("taskId");
      Log.d(TAG + "task id", Long.toString(taskId));
      animateToTaskPosition = true;
    } catch (NullPointerException e) {
      animateToTaskPosition = false;
    }

    mapView = (MapView) findViewById(R.id.map);
    mapView.setBuiltInZoomControls(true);
    mapView.setSatellite(false);

    mapController = mapView.getController();
    mapController.setZoom(16);

    receiver = new TaskUpdateReceiver();
    filter = new IntentFilter(SupervisorApplication.UPDATE_VIEW_INTENT);
    registerReceiver(receiver, filter);
  }
 protected void onResume() {
   super.onResume();
   Log.d(TAG, Boolean.toString(animateToTaskPosition));
   registerReceiver(receiver, filter);
   if (animateToTaskPosition) {
     Task task = global_app.getDataStorage().getTaskById(taskId);
     GeoPoint tmp =
         new GeoPoint((int) (task.getLatitude() * 1E6), (int) (task.getLongitude() * 1E6));
     mapController.animateTo(tmp);
   } else {
     lastLocation = global_app.getLastLocation();
     int lat = (int) (lastLocation.getLatitude() * 1E6);
     int lng = (int) (lastLocation.getLongitude() * 1E6);
     geoPoint = new GeoPoint(lat, lng);
     mapController.animateTo(geoPoint);
   }
   paintCurrentPostion();
   paintTasks();
 }