KevinGebhardt86

Bug when using OnStatusChangedListener?

Discussion created by KevinGebhardt86 on Jan 11, 2013
Latest reply on Feb 11, 2014 by knisleyj
Hello,
I'm caching a FeatureLayer to use it in offline mode. That works really good.
Now I want to do this automatically after the FeatureLayer has been loaded succesfully.
For this i use the OnStatusChangeListener of the MapView:

map.setOnStatusChangedListener(new OnStatusChangedListener(){

public void onStatusChanged(Object source, STATUS status) {
    
  if (source.equals(FeatureLayer) && status.equals(STATUS.LAYER_LOADED))
   {
                                cachingLayers();
                        }
        }
});
When the event is fired i get an error that sais that the Graphics of the FeatureLayer have not been loaded correctly.
But my oppinion is, when the event, that the FeatureLayer has been loaded correctly, was fired, all properties should be initialized.

The really interesting thing is the following:
When i put a Thread.sleep(500) before the Method cachingLayers() all properties have been loaded and the caching works.
I think this is quite strange and looks to me like a bug.

Has anyone perhaps an idea?

Outcomes