If you are new to asynchronous programming patterns using the DoneLoadingListener events then you might find this blog post a useful read. https://www.esri.com/arcgis-blog/products/developers/field-mobility/a-pitfall-of-asynchronous-java-c...