Google Maps android get longitude-latitude by moving a marker in the map

后端 未结 4 811
囚心锁ツ
囚心锁ツ 2021-02-09 13:36

Hi i am developping an android application in which i need the user to choose a location by mouving a parker so i can get the informations i need exactly like this but in an and

4条回答
  •  孤城傲影
    2021-02-09 14:27

    Utilize draggable markers, via the onMarkerDragEnd method

    @Override
    public void onMarkerDragEnd(Marker marker) {
        // TODO Auto-generated method stub
    }
    

    Within that method you could do something like

    LatLng position = marker.getPosition();
    double latitude = position.latitude;
    double longitude = position.longitude;
    

    There you have it. .........

提交回复
热议问题