如何让用户在哪里水龙头在Android上的地图上的纬度和位置的经度 [英] How to get the latitude and longitude of location where user taps on the map in android

查看:201
本文介绍了如何让用户在哪里水龙头在Android上的地图上的纬度和位置的经度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序中,我使用谷歌地图V2通过获取设备的当前位置的latitute和纬度来显示地图,我展示该位置针。

In my Android application, I'm using google maps v2 to show map by getting the latitute and longitude of the device's current location And I'm showing pin on that location.

现在,当用户点击,或在地图上的任何其他位置的水龙头,那么我得到那个点经纬度和我有在该位置设置引脚。

Now when user clicks or taps on any other location on the map, then I have to get that points latitude and longitude and i have to set the pin at that location.

你能告诉我怎么获得用户水龙头的纬度和经度/点击的位置。

Could you please tell me how get the latitude and longitude of the user taps/clicks location.

推荐答案

我使用的一个例子。相应地更改它为您的需求。我用它的长preSS。

An example of what i use. Change it accordingly for your needs. I use it with long press.

map.setOnMapLongClickListener(new OnMapLongClickListener() {
            @Override
            public void onMapLongClick(LatLng point) {
                    map.addMarker(new MarkerOptions().position(point).title("Custom location").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));enter code here
            }
        });

的经纬度点包含协调长preSS的

the LatLng point contains the coordinated of the longpress

这篇关于如何让用户在哪里水龙头在Android上的地图上的纬度和位置的经度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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