@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pressure_monitor); sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); pressuremeter = sensorManager.getDefaultSensor(Sensor.TYPE_PRESSURE); textViewPressure = (TextView) findViewById(R.id.textViewPressure); radioGroup = (RadioGroup) findViewById(R.id.radioGroup1); radioGroup.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.preasure) sensorId = 0; else if (checkedId == R.id.altitude) sensorId = 1; else sensorId = 2; plotLongHistory(); } }); setTitle("Pressure"); // setup the APR History plot: preHistoryPlot = (XYPlot) findViewById(R.id.pressurePlot); preHistoryPlot.setRangeBoundaries(900, 1300, BoundaryMode.AUTO); preHistoryPlot.setDomainBoundaries(0, 100, BoundaryMode.AUTO); // FIXED); preHistoryPlot.addSeries( pressureHistorySeries, new LineAndPointFormatter( Color.BLACK, Color.RED, null, new PointLabelFormatter(Color.TRANSPARENT))); preHistoryPlot.setDomainStepValue(5); preHistoryPlot.setTicksPerRangeLabel(3); // preHistoryPlot.setDomainLabel("Sample Index"); preHistoryPlot.getDomainLabelWidget().pack(); preHistoryPlot.setRangeLabel("Temperature (ºC)"); preHistoryPlot.getRangeLabelWidget().pack(); preHistoryPlot.setRangeLabel("Pressure (hPa)"); longHistoryPlot = (XYPlot) findViewById(R.id.longHistoryPlot); longHistoryPlot.setRangeBoundaries(900, 1300, BoundaryMode.AUTO); longHistoryPlot.setDomainBoundaries(0, 100, BoundaryMode.AUTO); // FIXED); longHistoryPlot.addSeries( longHistorySeries, new LineAndPointFormatter( Color.BLACK, Color.BLUE, null, new PointLabelFormatter(Color.TRANSPARENT))); longHistoryPlot.setDomainStepValue(5); longHistoryPlot.setTicksPerRangeLabel(3); longHistoryPlot.getDomainLabelWidget().pack(); longHistoryPlot.setRangeLabel("Temperature (ºC)"); longHistoryPlot.getRangeLabelWidget().pack(); longHistoryPlot.setRangeLabel("Pressure (hPa)"); // TEST if (!SamplingService.isRunning(this)) { SamplingAlarm.SetAlarm(this); } }