Compass指南者GPS目的地 [英] Compass guide to GPS destination

查看:181
本文介绍了Compass指南者GPS目的地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想旋转的的ImageView 从当前用户位置的一些previously保存GPS位置的箭头。如何做到这一点?

I want to rotate an ImageView with an arrow from the current user location to some previously saved GPS location. How do I do this?

时的初始轴承从 Location.distanceBetween 方法得到了正确的道路要走呢?如果是这样,我怎么使用它与指南针的读数?

Is the Initial Bearing got from the Location.distanceBetween method the right way to go on this? If so, how do I use it with the compass readings?

推荐答案

您可以使用<一个href="http://developer.android.com/reference/android/location/Location.html#bearingTo%28android.location.Location%29"相对=nofollow> bearingTo 位置类的方法, 然后利用获取当前轴承<一href="http://developer.android.com/reference/android/hardware/SensorManager.html#getOrientation%28float%5B%5D,%20float%5B%5D%29"相对=nofollow> SensorManager.getOrientation 的方法。

You can use the bearingTo method in Location class, then retrieve the current bearing using the SensorManager.getOrientation method.

最后,将两个结果,绘制箭头。

Finally, adding both results, draw the arrow.

希望它帮助。

这篇关于Compass指南者GPS目的地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆