public void OnLocationUpdate(Location loc) {
    Utilities.LogDebug("GpsMainActivity.OnLocationUpdate");
    DisplayLocationInfo(loc);
    ShowPreferencesSummary();
    SetMainButtonChecked(true);

    if (Session.isSinglePointMode()) {
      loggingService.StopLogging();
      SetMainButtonEnabled(true);
      Session.setSinglePointMode(false);
    }
  }
  /** Called when the single point button is clicked */
  public void onClick(View view) {
    Utilities.LogDebug("GpsMainActivity.onClick");

    if (!Session.isStarted()) {
      SetMainButtonEnabled(false);
      loggingService.StartLogging();
      Session.setSinglePointMode(true);
    } else if (Session.isStarted() && Session.isSinglePointMode()) {
      loggingService.StopLogging();
      SetMainButtonEnabled(true);
      Session.setSinglePointMode(false);
    }
  }
        public void onServiceConnected(ComponentName name, IBinder service) {
          loggingService = ((GpsLoggingService.GpsLoggingBinder) service).getService();
          GpsLoggingService.SetServiceClient(GpsMainActivity.this);

          Button buttonSinglePoint = (Button) findViewById(R.id.buttonSinglePoint);

          buttonSinglePoint.setOnClickListener(GpsMainActivity.this);

          if (Session.isStarted()) {
            if (Session.isSinglePointMode()) {
              SetMainButtonEnabled(false);
            } else {
              SetMainButtonChecked(true);
              SetSinglePointButtonEnabled(false);
            }

            DisplayLocationInfo(Session.getCurrentLocationInfo());
          }

          // Form setup - toggle button, display existing location info
          ToggleButton buttonOnOff = (ToggleButton) findViewById(R.id.buttonOnOff);
          buttonOnOff.setOnCheckedChangeListener(GpsMainActivity.this);
        }