01.
public
void
onSensorChanged(SensorEvent event) {
02.
if
(started) {
03.
04.
displayCurrentValues();
05.
AxisX = event.values[
0
];
06.
AxisY = event.values[
1
];
07.
AxisZ = event.values[
2
];
08.
09.
long
timestamp = System.currentTimeMillis();
10.
11.
if
((timestamp - lastUpdate) > UPDATE_INTERVAL) {
12.
lastUpdate = timestamp;
13.
try
{
14.
writerFile.write(
"X"
+
" , "
+ AxisX +
" , "
+
"Y"
+
" , "
+ AxisY +
" , "
+
"Z"
+
" , "
+ AxisZ +
"\n"
);
15.
}
catch
(IOException e) {
16.
e.printStackTrace();
17.
}
18.
}
19.
textX.setText(
"X : "
+ AxisX);
20.
textY.setText(
"Y : "
+ AxisY);
21.
textZ.setText(
"Z : "
+ AxisZ);
22.
}
23.
}