I have a .geodatabase from which I am creating FeatureLayers. I am trying to display a callout for the FeatureLayers. The callout works fine for polygons, however when I singleTap a point or polyline feature the callout shows and then hides. ??
map.setOnSingleTapListener(new OnSingleTapListener() {
private static final long serialVersionUID = 1L;
public void onSingleTap(float x, float y) {
if (!map.isLoaded()) {
return;
}
for (FeatureLayer featureLayer : gdbFeatureTableList) {
long [] selFeatures = featureLayer.getFeatureIDs(x, y, 10, 10);
if (selFeatures != null && selFeatures.length > 0) {
long targetID = selFeatures[0];
Feature feature = featureLayer.getFeature(targetID);
Map<String, Object> attributesMap = feature.getAttributes();
StringBuilder sb = new StringBuilder();
for (Entry<String, Object> att : attributesMap.entrySet()) {
if (!att.getKey().equalsIgnoreCase("GlobalID") && !att.getValue().toString().trim().equalsIgnoreCase("")) {
sb.append(att.getKey() + ": " + att.getValue().toString() + "\n");
}
}
String attributes = sb.toString();
callout.animatedShow(map.toMapPoint(new Point(x, y)), loadView(attributes));
}
else if (callout != null && callout.isShowing()) {
callout.animatedHide();
}
}
}
});
I usually miss the simple things... If you can see one, please let me know..