@Override
 protected void onPause() {
   super.onPause();
   if (reverseGeocoderTask != null) {
     reverseGeocoderTask.cancel(true);
   }
 }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) {
      // get the saved file name
      Preferences.loadSettings(AddReportActivity.this);
      photoName = Preferences.fileName;
      if (requestCode == REQUEST_CODE_CAMERA) {

        Uri uri = PhotoUtils.getPhotoUri(photoName, this);
        Bitmap bitmap = PhotoUtils.getCameraPhoto(this, uri);
        PhotoUtils.savePhoto(this, bitmap, photoName);
        log(String.format("REQUEST_CODE_CAMERA %dx%d", bitmap.getWidth(), bitmap.getHeight()));

      } else if (requestCode == REQUEST_CODE_IMAGE) {

        Bitmap bitmap = PhotoUtils.getGalleryPhoto(this, data.getData());
        PhotoUtils.savePhoto(this, bitmap, photoName);
        log(String.format("REQUEST_CODE_IMAGE %dx%d", bitmap.getWidth(), bitmap.getHeight()));
      }

      if (id > 0) {
        addPhotoToReport();
      } else {
        pendingPhoto.refresh();
      }
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    view.mLatitude.addTextChangedListener(latLonTextWatcher);
    view.mLongitude.addTextChangedListener(latLonTextWatcher);
    mapController = view.mapView.getController();
    view.mBtnPicture.setOnClickListener(this);
    view.mBtnAddCategory.setOnClickListener(this);
    view.mPickDate.setOnClickListener(this);
    view.mPickTime.setOnClickListener(this);
    mCalendar = Calendar.getInstance();
    pendingPhoto = new UploadPhotoAdapter(this);
    view.gallery.setAdapter(pendingPhoto);
    view.gallery.setOnItemClickListener(this);
    view.mSwitcher.setFactory(this);
    if (getIntent().getExtras() != null) {
      this.id = getIntent().getExtras().getInt("id", 0);
    }
    mOgsDao = Database.mOpenGeoSmsDao;
    // edit existing report
    if (id > 0) {

      // make the delete button visible because we're editing
      view.mDeleteReport.setOnClickListener(this);
      view.mDeleteReport.setVisibility(View.VISIBLE);
      setSavedReport(id);
    } else {
      // add a new report
      updateDisplay();
      pendingPhoto.refresh();
    }

    registerForContextMenu(view.gallery);
    createSendMethodDialog();
  }
 protected void onPause() {
   super.onPause();
   try {
     unregisterReceiver(uploadBroadcastReceiver);
   } catch (IllegalArgumentException e) {
   }
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.id = getIntent().getExtras().getInt("id", 0);

    mapController = view.mMapView.getController();
    view.mPickPhoto.setOnClickListener(this);
    pendingPhoto = new UploadPhotoAdapter(this);
    view.gallery.setAdapter(pendingPhoto);
    view.gallery.setOnItemClickListener(this);
    view.mSwitcher.setFactory(this);
    // edit existing report
    if (id > 0) {

      // make the delete button visible because we're editing
      view.mDeleteCheckin.setOnClickListener(this);
      view.mDeleteCheckin.setVisibility(View.VISIBLE);
      setSavedCheckins(id);
    } else {
      // add a new report
      pendingPhoto.refresh();
    }

    registerForContextMenu(view.gallery);

    hidePersonalInfo();
  }
 // Context Menu Stuff
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   new MenuInflater(this).inflate(R.menu.photo_context, menu);
 }
 /**
  * Upon being resumed we can retrieve the current state. This allows us to update the state if it
  * was changed at any time while paused.
  */
 @Override
 protected void onResume() {
   getSharedText();
   super.onResume();
 }
 @Override
 protected void onStart() {
   super.onStart();
 }
 @Override
 public void onResume() {
   super.onResume();
   registerReceiver(
       uploadBroadcastReceiver, new IntentFilter(SyncServices.UPLOAD_CHECKIN_SERVICES_ACTION));
 }