0
我需要做的是当“用户”标记进入(比方说50米半径)某个感兴趣的地方标记弹出对话框的半径时出现一个对话框(showplaceDialog())。当在标记周围50米范围内时,触发方法
我该怎么办?我根本没有线索怎么做...
这是我如何把“用户”标记,它随着位置的变化而移动。
@Override
public void onLocationChanged(Location location) {
Log.d("Location", "onLocationChanged with location " + location.toString());
if(overlayMarkerYou == null) {
overlayMarkerYou = new MyOverlay(getResources().getDrawable(R.drawable.marker_you),mapView);
mapView.getOverlays().add(overlayMarkerYou);
}else{
mapView.getOverlays().remove(overlayMarkerYou);
mapView.invalidate();
overlayMarkerYou = new MyOverlay(getResources().getDrawable(R.drawable.marker_you),mapView);
mapView.getOverlays().add(overlayMarkerYou);
}
if (location != null) {
mapView.invalidate();
GeoPoint gpt = new GeoPoint(microdegrees(location.getLatitude()),microdegrees(location.getLongitude()));
mapController.setCenter(gpt);
overlayMarkerYou.addPoint(gpt, getString(R.string.markerYou), getString(R.string.markerYouDescription));
}
}
这就是我如何把多个标记感兴趣
地方public void putPlacesOfInterest(){
this.dh = new DataHelper(ShowMap.this);
List<Pontos> list = this.dh.selectAll();
for(Pontos p : list){
markerPlaces.add(new OverlayItem(p.getName().toString(), Long.toString(p.getId()), new GeoPoint(p.getLat(), p.getLng())));
}
mMyLocationOverlay = new ItemizedIconOverlay<OverlayItem>(markerPlaces, new OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemLongPress(int index, OverlayItem item) {
Toast.makeText(ShowMap.this, "" + item.mTitle, Toast.LENGTH_SHORT).show();
return true;
}
@Override
public boolean onItemSingleTapUp(int index, OverlayItem item) {
showplaceDialog(Integer.parseInt(item.mDescription),item.mTitle);
return true;
}
}, mResourceProxy);
mapView.getOverlays().add(mMyLocationOverlay);
mapView.invalidate();
}
接近警报是要走的路。 – Snicolas 2012-03-17 17:59:09
我应该在内部使用'addProximityAlert()'作为(Pontos p:list){'right? – silentw 2012-03-17 18:03:36
我无法得到它的工作,你能给我一个例子调用'showplaceDialog()'函数吗?谢谢 – silentw 2012-03-17 19:44:40