示例#1
0
        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);
        }
示例#2
0
 public void SetMainButtonEnabled(boolean enabled) {
   ToggleButton buttonOnOff = (ToggleButton) findViewById(R.id.buttonOnOff);
   buttonOnOff.setEnabled(enabled);
 }
示例#3
0
 public void SetMainButtonChecked(boolean checked) {
   ToggleButton buttonOnOff = (ToggleButton) findViewById(R.id.buttonOnOff);
   buttonOnOff.setChecked(checked);
 }
 public void toggleConnection(View view) {
   ToggleButton tb = (ToggleButton) view;
   if (tb.isChecked()) tb.setChecked(connect(view));
   else disconnect(view);
 }