【发布时间】:2015-12-04 03:14:41
【问题描述】:
我已经尝试过这段代码,但它似乎不能有效地检查抖动持续时间。长时间摇晃我想得到更远的经纬度。
@Override public void onSensorChanged(SensorEvent event){
ImageView colorBox = (ImageView)findViewById(R.id.colorBox);
TextView latText = (TextView)findViewById(R.id.latText);
TextView lngText = (TextView)findViewById(R.id.longText);
if(event.sensor.getType() == Sensor.TYPE_ACCELEROMETER){
float[] values = event.values;
float x = values[0];
float y = values[1];
float z = values[2];
float acclt = (x*x+ y*y+ z*z)/(SensorManager.GRAVITY_EARTH*SensorManager.GRAVITY_EARTH);
long actualTime = System.currentTimeMillis();
if(acclt >2) {
}
}
}
【问题讨论】: