Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在创建一个 android 指南针应用程序。 但是,我想添加一个功能,其中指南针将指向我指定的某个坐标。 我怎样才能做到这一点。
谢谢和问候, Rohit Savant
对于您想要实现的目标,您将需要 2 个位置,即您自己的位置和目标位置。然后您可以使用该bearingTo()方法确定您与目标的角度:
bearingTo()
Location me = ... Location target = ... float angle = me.bearingTo(target);