无法使用地图叠加层识别变量类型

时间:2013-05-17 20:57:35

标签: android google-maps-android-api-2

我正在尝试从这个非常好的blog实现代码。我到最后几行,但我无法弄清楚什么类型的变量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();
}

1 个答案:

答案 0 :(得分:0)

您正在尝试关注使用已弃用的Maps API v1的博客。即使你完成了,你也不会得到任何好结果。

而是切换到使用Google Maps Android API v2。如果您想关注某个博客,请搜索2013年或更晚的内容。

相关问题