android地图实时标记
============问题描述============
我在用百度地图给上边做标注的时候,用了一下主要代码:
class MyOverlayItem extends ItemizedOverlay<OverlayItem> { private ArrayList<OverlayItem> mOverlayList = new ArrayList<OverlayItem>(); private double mLat1 = 34.0358298501404; // point1纬度 private double mLon1 = 108.7622674067471; // point1经度 private double mLat2 = geoPointList.get(0).getLat(); private double mLon2 = geoPointList.get(0).getLongi(); public MyOverlayItem(Drawable drawable) { super(drawable); GeoPoint geoPoint = new GeoPoint((int)(mLat1 * 1E6), (int)(mLon1 * 1E6)); GeoPoint GeoPointBaidu = CoordinateConvert.fromWgs84ToBaidu(geoPoint); mOverlayList.add(new OverlayItem(GeoPointBaidu, "point", "point")); populate(); }
问题出现了,若使用mLat1,mLon1作为坐标时就能正确打点,但是换成mLat2,mLon2就点打不上去,mLat2,mLon2其实值跟mLat1,mLon1是相同的。这里mLat2,mLon2也不是空值。我是在mainactivity中的handler中调用
mMapView.getOverlays().add(new MyOverlayItem(drawable));来实现的。求解,纠结了一天了,先谢过了。
============解决方案1============
刷新下画布。
posted on 2014-10-17 10:37 android基础教程 阅读(297) 评论(0) 编辑 收藏 举报