Bug when using OnStatusChangedListener?

01-11-2013 01:33 AM
New Contributor III
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))
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?
0 Kudos
2 Replies
New Contributor
maybe you should focus the Options of ArcGISFeatureLayer, change options.mode and try again ? i just surmise�??:(
0 Kudos
Occasional Contributor
Can someone from ESRI please comment? This looks like a long standing issue, first mentioned over a year ago in this thread: Dynamic layer does not load or only after device rotation

Does this ever actually fire, and if so, what are the conditions? I have an issue where I'm trying to update the symbology for a few graphics after an ArcGISFeatureLayer has loaded, and if I try to do this on status INITIALIZED it sometimes crashes the program. Here are the relevant LogCat lines:
02-11 17:18:39.846: I/Runtime Core(5226): encoding image failure in Picture_marker_symbol::to_JSON
02-11 17:18:39.846: A/libc(5226): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 5310 (pool-2-thread-1)

As it's intermittent, it seems obvious that calling Layer.updateGraphic() after STATUS.Initialized is error prone, but I can't find a reliable way to know that it is a safe call to make. Obviously I can put in an arbitrary delay which should *fix* the problem, but I have to believe there is a cleaner way to do this. Can someone from ESRI please enlighten me?
0 Kudos