Hi,
I've hit a wall on an app I'm writing. What the app does is it has a
list of locations that are marked on a Map through an Overlay. What I
want to do is make it so when the user clicks on a point, a dialog
will pop up giving some information that has been stored in a database
about that location. I have gotten this to work to some degree using
onTouchEvent in the Overlay (another class called MapOverlay) and an
OnTouchListener in the MapActivity. However, the problem is that once
I click to move the map around or bring up the zoom controls, it seems
like the OnTouchListener dies and does not get reactivated or that the
overrided method OnTouch in the OnTouchListener is never called again.
I can't do showDialog in an Overlay, and all attempts to launch a
Dialog through the MapOverlay have failed so far. Any suggestions?
Thanks,
Andrew
Here is some of the code in the Map class (which extends MapActivity):
private Cursor c;
private MapController mapController;
private MapView mapView;
private MapOverlay mapOverlay
OnTouchListener OTL = new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event){
if(mapOverlay.onTouchEvent(event, mapView)){
showDialog(DIALOG_ID);
mapView.invalidate();
return true;
}
return false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
adapter = new Adapter(this);
adapter.open();
mapView = (MapView) findViewById(R.id.mapview);
mapView.setSatellite(true);
mapView.setStreetView(true);
mapView.setBuiltInZoomControls(true);
c = adapter.getAll();
startManagingCursor(c);
mapController = mapView.getController();
mapOverlay = new MapOverlay(c);
mapView.getOverlays().add(mapOverlay);
mapView.setOnTouchListener(OTL);
mapView.postInvalidate();
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---