我正在添加折线选项,就像谷歌开发者的网站一样.
PolylineOptions rectOptions = new PolylineOptions()
.add(new LatLng(37.35, -122.0))
.add(new LatLng(37.45, -122.0)) // North of the previous point, but at the same longitude
.add(new LatLng(37.45, -122.2)) // Same latitude, and 30km to the west
.add(new LatLng(37.35, -122.2)) // Same longitude, and 16km to the south
.add(new LatLng(37.35, -122.0)); // Closes the polyline.
// Get back the mutable Polyline
Polyline polyline = myMap.addPolyline(rectOptions);
Run Code Online (Sandbox Code Playgroud)
我想删除它.但是rectOptions.remove()
我没有在谷歌地图Android API v2中提到我的sdk更新谷歌播放服务,如何从地图中删除多线?
但我仍然没有.从SDK管理器更新后我应该做些什么吗?我真的需要删除它而不是让它不可见以节省内存因为我会多次显示许多点的路径.
我要做的最后一件事是:我的应用程序中有谷歌地图,带有som按钮和额外的东西.但我还必须在我的地图内一直显示标记的更新位置(我将从外部设备获取数据而不是Android手机的GPS传感器).因此,我认为首先使用线程,但随后当你在我的代码中看到改变为的AsyncTask并试图用addMarker方法有,但我每次运行它映射时间只是stopps工作.我想现在只在地图上显示一个标记但现在成功了!无法通过UI线程和AsyncTask内部访问GoogleMap地图为什么?有谁遇到过这个?我该怎么做才能解决这个问题......请帮忙
package com.example.mapsversion2;
//All imports
public class MainActivity extends Activity {
static final LatLng exmpoint = new LatLng(59.331438,18.064957);
public static GoogleMap map;
Button button;
Button waypointButton;
Button destinationButton;
Marker wayPoint;
TextView positiontext;
int countclick= 3;
public static DataModel autoboxdata= new DataModel();
public static Bitmap arrowBitmap;
Marker currentPlace;
MapFragment mapF;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapF = ((MapFragment) getFragmentManager().findFragmentById(R.id.map));
map= mapF.getMap();
map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
// positiontext = (TextView) findViewById(R.id.position);
// Move the camera instantly to hamburg with a zoom of …Run Code Online (Sandbox Code Playgroud)