AnsweredAssumed Answered

Make graphics clickable instead of create new graphics in map

Question asked by Grontag on Sep 5, 2018

So, I have a map with a MapOnTouchListener on it. I have overriden the OnSingleTap method (allPoints is an array where all markers are added for a non related to this question functionality):



@Override public boolean onSingleTap(MotionEvent point) {

Point mapPoint=view.toMapPoint(point.getX(), point.getY());

new GeocoderAsynckTask(mapPoint,view).execute(mapPoint);

SpatialReference sp = SpatialReference.create(SpatialReference.WKID_WGS84);

Point p1Done=(Point) GeometryEngine.project(mapPoint, mvHelper.getMapView().getSpatialReference(), sp); allPoints.add(p1Done);

return super.onSingleTap(point);



That GeoCoderAsyncTask translates the coords of the point to an address, and adds a marker to the map. The geocoding is done just right, I get my address and in PostExecute method I add the marker to the map:

protected void onPostExecute(String address) {



SpatialReference sp = SpatialReference.create(SpatialReference.WKID_WGS84);

Point p1Done=(Point) GeometryEngine.project(point, mvHelper.getMapView().getSpatialReference(), sp); mvHelper.addMarkerGraphic(p1Done.getY(), p1Done.getX(), "Location", address, android.R.drawable.ic_menu_myplaces, null, false, 1);



The problem is, I want the markers to be clickable, but if I click them, another marker is added. I have tried to nullify the MapOnTouchListener, but that way, no marker is added, and no click on marker is detected...


How could I acomplish that?


Thank you.