关于arcgis for android图层点击事件
需求:点击加载的图层,获取图层的属性
mMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, mMapView){
@Override
public boolean onSingleTapUp(MotionEvent e) {
final android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY()));
ListenableFuture<IdentifyLayerResult> identifyLayerResultListenableFuture = mMapView.identifyLayerAsync(featureLayer_town, screenPoint, 10.0, false);
identifyLayerResultListenableFuture.addDoneListener(()->{
try {
IdentifyLayerResult identifyLayerResult = identifyLayerResultListenableFuture.get();
List<GeoElement> elements = identifyLayerResult.getElements();
for (GeoElement element : elements){
showTips(element.getAttributes().toString());
}
} catch (InterruptedException | ExecutionException exception) {
exception.printStackTrace();
}
});
return super.onSingleTapUp(e);
}
});