I'm developing a simple counter app which counts when the user move their phone along the x axis(positive or negative) about 90 degrees.i'm using the accelerometer for measuring the acceleration cause by moving the phone and using this for counting. but there is a problem,the accuracy is not good,sometimes it doesn't count and sometimes it count twice. this is my code,i want to know if there is a way to get good accuracy?
@Override
protected void onResume() {
super.onResume();
SnManager.registerListener(this,acc,SensorManager.SENSOR_DELAY_NORMAL);
}
@Override
public void onSensorChanged(SensorEvent event) {
if(!stop) {
if (event.values[0] > 14) {
Count++;
txt_count.setText("" + Count);
values.add("OK");
}
values.add(""+event.values[0]);
lst.invalidate();
}
}