getting Graphics after STATUS.LAYER_LOADED

4371
1
09-03-2015 09:08 AM
CesarRevilla
New Contributor III

Hi,

I want to read the attributes of the Features on a FeatureLayer (snapshot mode) directly after the feature was loaded.

But after the feature layer was loaded i found the following problems:

if (STATUS.LAYER_LOADED == status && source == feature_layer)

{

     // HIER: count == 0

     int count = feature_layer.getNumberOfGraphics();

     ....

     ////ALTERNATIVE

     // HIER: Throw an exception

     GraphicsLayer gl = (GraphicsLayer) feature_layer;

     int[] ids = gl.getGraphicIDs();
     for(int id : ids){

          Graphic g = gl.getGraphic(id);

          ....

   }

}

where can I insert my code to use the data of the features on layer after they was loaded?

Best Regards,

Cesar

1 Reply
EricBader
Occasional Contributor III

You should be able to get the FeatureTable from the FeatureLayer after it is loaded.

Have you tried something like this?:

long count = feature_layer.getFeatureTable().getNumberOfFeatures();