1
안드로이드 장치에서 길고 위도가 있지만 결과가 충분하지 않습니다. 나는 내 결과 INT 번호를 의미 : 37.0 또는 260.0에 .. 나는 두 숫자 37.001 싶어 - 37.999안드로이드 장치의 onSensorChanged
내 코드 :
// record the compass picture angle turned
private float currentDegree = 0f;
// device sensor manager
private SensorManager mSensorManager;
@Override
public void onSensorChanged(SensorEvent event) {
// TODO Auto-generated method stub
// get the angle around the z-axis rotated
float degree = Math.round(event.values[0]);
tvHeading.setText(Float.toString(degree));
// create a rotation animation (reverse turn degree degrees)
RotateAnimation ra = new RotateAnimation(
currentDegree,
-degree,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF,
0.5f);
// how long the animation will take place
ra.setDuration(210);
// set the animation after the end of the reservation status
ra.setFillAfter(true);
// Start the animation
currentDegree = -degree;
// updateWithNewLocation(l);
}
희망이 도움이됩니다. 감사.
문제 해결 :이 같은 정의 정도 필요 :
float degree = event.values[0];
또 다른 문제는 다음과 같습니다 내 결과가 360.0-0.0 사이에, 나는 6400.999
에 0.000의 결과 애큐 리트를 원하는 것입니다문제가 해결됨 : 0-6400 사이의 차수를 지정하는 경우 :
double result =degree * 17.77777778;
degree = (float) result;
예 : 3200은 180이어야합니다. 180 * 17.77777778은 정확히 3200입니다. 고마워. 즐겨 :)
제가 생각했던 것입니다. – RonYamin
나는 답을 편집 해 그것을 체크 아웃했다. 그것이 친절하게 작동한다면 내 대답에 틱하고 또한 내 대답에 투표하십시오. –
나는 그 자체로 내가 문제를 해결했다. 보세요. 고마워. – RonYamin