kstanoev
4/7/2014 - 10:39 AM

Update the vertical position of the needle.

Update the vertical position of the needle.

@Override
public void onSensorChanged(SensorEvent event) {
 
    // get the new point based on the readings from the accelerometer
    SeismicDataPoint point = new SeismicDataPoint(this.framesCount++, event.values[this.currentAxisIndex]);
 
    // add the point to a collection of all the points that should be visible on the screen
    this.seismicActivityBuffer.add(point);
 
    // draw the chart with all the points that should be visible*
    this.chart = createChart(seismicActivityBuffer);
 
    // keep the point in another collection, for historic purposes
    this.allSeismicActivity.add(point);
    
    // update the vertical position of the needle
    this.needle.updatePosition(point.y);
}