Hello.
I'm develping an app on Andoird and I'm stuck on adding Values from a sensor to an arrayList.
The sensor is working good because it shows my in the Log. But the (ArrayList) al.Size() = 0.
Code:
ArrayList<Float> aL = new ArrayList<Float>();
sm SensorManger = (SensorManager) getSystemService(SENSOR_SERVICE);
public void onCreate(Bundle savedInstanceState) {
runSenor();
...///SOME CODE OVER HERE///...
}
@Override
public void onSensorChanged(int sensor, float[] values) {
aL.add(values[1]);
Log.d("Log", "Accel Y: "+ values[1])
}
public void runSensor(){
sm.registerListener(this,
SensorManager.SENSOR_ACCELEROMETER,
SensorManager.SENSOR_DELAY_UI);
}
public void stopSensor(){
sm.unregisterListener(this);
}
Does any body knows what I'm doing worg ?
Thank you for any help
Regards