I wrote something like this:
public class MainActivity extends AppCompatActivity {
MapView mMapView;
GraphicsLayer mGraphicsLayer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mMapView = (MapView) findViewById(R.id.map_view);
mMapView.setOnSingleTapListener(new OnSingleTapListener() {
@Override
public void onSingleTap(float v, float v1) {
Point point = mMapView.toMapPoint(v, v1);
int[] graphicIDs = mGraphicsLayer.getGraphicIDs(v, v1, 1, 1);
for (int i = 0; i < graphicIDs.length; i++) {
Log.d("NOHE", "GRAPHIC: " + graphicIDs);
}
mGraphicsLayer.setSelectedGraphics(graphicIDs, true);
}
});
mGraphicsLayer = new GraphicsLayer(mMapView.getSpatialReference(), mMapView.getMaxExtent(), GraphicsLayer.RenderingMode.DYNAMIC);
mGraphicsLayer.addGraphic(new Graphic(new Point(-8416452.130, 4628356.957), new PictureMarkerSymbol(ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_marker))));
mGraphicsLayer.setSelectionColorWidth(3);
mGraphicsLayer.setSelectionColor(R.color.selectionColor);
mMapView.addLayer(mGraphicsLayer);
}
}
More logic is required for you to get it working exactly the way you want. The important portion here is the onSingleTap listener. You could modify this code to remove and add selections.