Package com.casioeurope.mis.edt.type
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 theonCreate
method.
When the activity is being launched (and hence the process gets created), the same applies to theonStart
andonResume
methods.
If you need to call any Library methods at application start in one of the above mentioned methods, you should use theCallback
Mechanism offered by theonLibraryReady
method instead.
For instance, instead of calling MyLibrary.myMethod() directly inonCreate
, use this code to postpone it to aCallback
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
-
Method Details
-
onLibraryReady
Callback Method which will get called once the regarding library becomes available- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.
-