Interface LibraryCallback


public interface LibraryCallback
Callback Interface to be used to postpone Library Method calls until the regarding library becomes available
API Note:
Each of the Libraries in EDT is bound to the calling application on application startup time automatically.
The Library's lifecycle therefore depends on the application lifecycle.
Due to the Lifecycle of Android Applications and the underlying timing, it is strongly advised not to call any Library Methods inside the onCreate method.
When the activity is being launched (and hence the process gets created), the same applies to the onStart and onResume methods.
If you need to call any Library methods at application start in one of the above mentioned methods, you should use the Callback Mechanism offered by the onLibraryReady method instead.
For instance, instead of calling MyLibrary.myMethod() directly in onCreate, use this code to postpone it to a Callback appropriately:
MyLibrary.onLibraryReady(new LibraryCallback() {
     public void onLibraryReady() {
         MyLibrary.myMethod();
     }
 });

Which can be simplified to:
MyLibrary.onLibraryReady(() -> { MyLibrary.myMethod(); });

Or even further to:
MyLibrary.onLibraryReady(MyLibrary::myMethod);
  • Method Summary

    Modifier and Type Method Description
    void onLibraryReady()
    Callback Method which will get called once the regarding library becomes available