I have a sliding drawer in a map view... Now i need to make this siding drawer dissappear on the click of mapview... I tried mapview.setonclick listener but it didnt worked... How to do it?
Asked
Active
Viewed 3,320 times
2 Answers
2
here is the similar question was asked here you have to implement with the Overlay class for the map on click event see this
here is the code for implementation
public class MyMapActivity extends MapActivity {
class MapOverlay extends com.google.android.maps.Overlay{
@Override
public boolean onTouchEvent(MotionEvent e, MapView mapView) {
if (e.getAction() == 1) {
Toast.makeText(getApplicationContext,"on click",2000).show();
}
return false;
}
}
// MyMapActivity methods
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapOverlay mapOverlay = new MapOverlay();
List<Overlay> listOfOverlays = mapView.getOverlays();
listOfOverlays.clear();
listOfOverlays.add(mapOverlay);
}
}