Issue
Does anyone know how, if possible, to display a popup infoWindow type bubble when a marker is tapped on an ArcGIS MapView in an Android app?
I've managed to create a SimpleMarkerSymbol type marker but I would like to be able to display more information about the marker when the user presses on it, not sure if this is even possible in ArcGIS. Thanks
code for map and marker:
GraphicsLayer graphicsLayer = new GraphicsLayer();
mapView = (MapView) findViewById(R.id.mapView);
mapView.addLayer(graphicsLayer);
SimpleMarkerSymbol simpleMarker = new SimpleMarkerSymbol(Color.RED, 10, SimpleMarkerSymbol.STYLE.CROSS);
Point pointGeometry = new Point(34.056215, -117.195668);
Graphic pointGraphic = new Graphic(pointGeometry, simpleMarker);
graphicsLayer.addGraphic(pointGraphic);
Solution
You have three things you need to accomplish:
- Listen for the user's tap. This is done by adding an
OnSingleTapListener
to theMapView
. - Query the graphics for the point the user tapped. You can use
GraphicsLayer.getGraphicIds(float, float, int, int)
to query the graphics. - Display the popup. This is done by calling
MapView.getCallout().show(Point, View)
.
Check out a really awesome example of an OnSingleTapListener
that does #2 and #3. At least I think it's awesome because I wrote it. ;-)
Answered By - Gary Sheppard
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.