ArcGISLayerInfo is not loading

Discussion created by jeffsays on Dec 19, 2012
Latest reply on Feb 26, 2013 by fandre12345

When I use the getLayers() method on my ArcGISDynamicMapServiceLayer and assign it to an array of ArcGISLayerInfo objects I cannot access the individual layers. I keep on receiving a NullPointerException. I believe that this is because the server is not pulling down the layers fast enough. Is there a way to make sure that the layers are pulled down before I try to access the information in the ArcGISLayerInfo array?