我正在使用谷歌地图v2 android和地图也显示在我的应用程序中.我只想从给定的地址获取纬度和经度.
示例:在文本字段中,如果我键入"Indore",那么我将获得该城市的纬度和经度.
我在每个onLocationChange上得到纬度和经度并制作这样的路线:
public void onLocationChanged(Location location) {
PolylineOptions rectLine2;
rectLine2.add(new LatLng(lat, lon));
mGoogleMap.addPolyline(rectLine2);
}
Run Code Online (Sandbox Code Playgroud)
现在我想在一次点击时清除这条路线,并且当我移动时,应该画一条新路线,但在我的情况下,旧路线不清楚.
我做了以下但没有工作:
mGoogleMap.clear();// It clear's the map, but when I again draw the old route again comes.
Run Code Online (Sandbox Code Playgroud)
也
Polyline polyline;
polyline = mGoogleMap.addPolyline(rectLine2);
polyline.reomve()// This also didn't work.
Run Code Online (Sandbox Code Playgroud)
有没有其他解决方案来清除地图?
提前致谢!