hello i want to rotate image view by latitude and longitude suppose i have
lat/LNG: (33.6343541968021,73.06278146803379)
now i want my image-view(needle) point this location how i can do this? i am doing this
public void onSensorChanged(SensorEvent event) {
float degree = Math.round(event.values[0]);
RotateAnimation ra1 = new RotateAnimation(
currentDegree,
-degree,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF,
0.5f);
// how long the animation will take place
ra1.setDuration(0);
// set the animation after the end of the reservation status
ra1.setFillAfter(true);
compass_img.startAnimation(ra1);
currentDegree= -degree;}
i am using orientation sensor
Try this way
Check Create our Android Compass and Rotating a Bitmap in Android