我正在尝试实现这个非常好的博客中的代码。我一直到最后几行,但我无法弄清楚 locationOverlays 是什么类型的变量。有没有谷歌地图Android经验的人能弄清楚这是什么类型的?我已经盯着它看了很长时间,但我没有到达任何地方。谢谢你。
public class RouteActivity extends MapActivity implements LocationListener {
@Override
public void onLocationChanged(Location location) {
drawUserPosition(location);
}
private void drawUserPosition(Location location) {
GeoPoint currentLocation;
currentLocation = new GeoPoint((int) ( location.getLatitude() * 1E6), (int) ( location
getLongitude() * 1E6));
OverlayItem currentLocationOverlay = new OverlayItem(currentLocation, getString(R.string.your_location),
getString(R.string.current_location));
mapOverlays.clear();
if (locationOverlays.size() > 1) {
// remove the old user position if there is one
locationOverlays.removeOverlay(1);
}
//add new user position
locationOverlays.addOverlay(currentLocationOverlay, this.getResources().getDrawable(R.drawable.someImage));
mapOverlays.add(locationOverlays);
//.
//. calculate / set the mapcenter, zoom to span
//. see in previous posts
//.
RouteThread rt = new RouteThread(currentLocation, synyxGeoPoint, routeHandler);
rt.start();
}