如何获得蓝点在Android地图V2的坐标 [英] How to get the coordinates of the blue dot in android maps v2

查看:208
本文介绍了如何获得蓝点在Android地图V2的坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个Map我想从我的位置的路径方向显示在一定位置。我已经实现了逻辑在地图上绘制的路径了,但我有我的确定的当前位置的问题。

On a Map I want to show the path direction from my location to a certain location. I have implemented the logic for drawing the path on the map already, but I have issues determinate my current location.

我是用新的LocationClient检索,就像它在这篇文章中描述了我当前的位置:的 http://developer.android.com/training/location/retrieve-current.html ,和我读的地方,新的地图API v2中使用相同的技术获取我的位置。

I have being using new LocationClient for retrieving my current location just like it is described in this article: http://developer.android.com/training/location/retrieve-current.html , and i have read somewhere that the new maps API v2 is using the same technique for getting my location.

无论如何,当我在地图上绘制的路径方向从我的位置到所需的一个,该路径的起始点是从蓝点标志着我的当前的位置不同。

Anyway, when I draw the path directions on the map from my location to the desired one, the starting point of the path is different from the blue dot that marks my current location.

蓝点显示了正确的位置,我的实现没有。那么,有没有办法让蓝色圆点标记的坐标,像 map.getMyLocationMarker()的getLocation()或者我需要找出一些其他的方式来手动获取我的位置?

The blue dot shows the right position, and my implementation doesn't. So, is there a way to get the coordinates of the blue dot marker, something like map.getMyLocationMarker().getLocation() or I need to figure out some other way to get my location manually?

更新

我忘了,我已经离开这个问题打开了,但这里是我的回答如下。

I forgot that I have left this question opened, but here is my answer below.

推荐答案

这实际上是一个非常愚蠢的错误,我做到了。

It was actually a really stupid mistake I did.

但这里就是答案。在链接中的问题描述的过程是做正确的事。

But here is the answer. The procedure described in the link in the question is the right thing to do.

我的问题是,我所取得的数据保存到一个新的共享preferences键,我是从旧哪里错了位置保存阅读。是啊是pretty哑:)

My problem was that I saved the fetched data to a new shared preferences key, and I was reading it from the old one where the wrong location was saved. Yeah it is pretty dumb :)

因此​​,遵循Android开发者门户网站的教程,并会有不犯错误吧。

So follow the tutorial on android developer portal and there will be no mistakes with it.

这篇关于如何获得蓝点在Android地图V2的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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