dear everyone:
I got an error when i writed the code.I wanted to find features in a geodatabase file.
the error is :
Feature search failed for: asd. Error: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid call.: Object failed to load, unable to execute task.
My code is follow the sample :Feature layer query.
https://developers.arcgis.com/android/java/sample-code/feature-layer-query/
here is my code:
private void searchForState(final String searchString) {
// clear any previous selections
mFeatureLayer = featureLayerList.get(0);
mFeatureLayer.clearSelection();
// create objects required to do a selection with a query
QueryParameters query = new QueryParameters();
// make search case insensitive
query.setWhereClause("upper(STATE_NAME) LIKE '%" + searchString.toUpperCase() + "%'");
// call select features
final ListenableFuture<FeatureQueryResult> future = mServiceFeatureTable.queryFeaturesAsync(query);
// add done loading listener to fire when the selection returns
future.addDoneListener(() -> {
try {
// call get on the future to get the result
FeatureQueryResult result = future.get();
// check there are some results
Iterator<Feature> resultIterator = result.iterator();
if (resultIterator.hasNext()) {
// get the extent of the first feature in the result to zoom to
Feature feature = resultIterator.next();
Envelope envelope = feature.getGeometry().getExtent();
mMapView.setViewpointGeometryAsync(envelope, 10);
// select the feature
mFeatureLayer.selectFeature(feature);
} else {
Toast.makeText(this, "No states found with name: " + searchString, Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
String error = "Feature search failed for: " + searchString + ". Error: " + e.getMessage();
Toast.makeText(this, error, Toast.LENGTH_LONG).show();
Log.e("zhz search :", error);
}
});
}