AnsweredAssumed Answered

featureLayer.getFeatureIDs thorws IllegaleStateException

Question asked by _hassan on Feb 15, 2015

Hello everybody

 

I've an .geodatabase file and read all layers like this

 

try {             Geodatabase geodatabase = new Geodatabase(Environment                     .getExternalStorageDirectory().getPath()                     + "/ArcGIS/samples/OfflineRouting/Routing/gis.geodatabase");              List<GeodatabaseFeatureTable> geodatabaseFeatureTablesList = geodatabase                     .getGeodatabaseTables();              geodatabaseFeatureTables = new ArrayList<GeodatabaseFeatureTable>();             for (int i = geodatabaseFeatureTablesList.size() - 1; i >= 0; i--) {                 geodatabaseFeatureTables.add(geodatabaseFeatureTablesList                         .get(i));             }                       for (int i = geodatabaseFeatureTablesList.size() - 1; i >= 0; i--) {                 addLayer();             }                      } catch (FileNotFoundException e) {             // TODO Auto-generated catch block             e.printStackTrace();         }

 

I've tried to select an feature in the layer like this

 

mMapView.setOnSingleTapListener(new OnSingleTapListener() {             private static final long serialVersionUID = 1L;              public void onSingleTap(float x, float y) {                 // gets the first 1000 features at the clicked point on the map,                 // within 5 pixels                  for (int i = 0; i < geodatabaseFeatureTables.size(); i++) {                     try {                         FeatureLayer featureLayer = new FeatureLayer(                                 geodatabaseFeatureTables.get(i));                         long[] selectedFeatures = featureLayer.getFeatureIDs(x,                                 y, 5, 1000);                          if (selectedFeatures != null) {                             // select the features                             featureLayer                                     .selectFeatures(selectedFeatures, false);                         }                     } catch (Exception exception) {                         System.out.println(exception.getMessage());                     }                      // long[] selectedFeatures = featureLayer.getFeatureIDs(x,                     // y, 5, 1000);                     // // select the features                     // featureLayer.selectFeatures(selectedFeatures, false);                 }              }         });

 

it throw IllegaleStateException in line 12 above can any one help me

where is the wrong

Outcomes