CubeModule
Updated at:
Introduction
Custom modules must inherit from this class. Implement the following methods to define module behavior.
// Annotation. uiThread specifies whether to invoke the callback on the main process.
@JsMethod(uiThread = true)
public void showToast(JSONObject object, final CubeJSCallback callback) {
if (object != null && !object.isEmpty()){
String msg = object.getString("message");
Toast.makeText(ContextUtils.getInstance().getContext(), msg, Toast.LENGTH_SHORT).show();
}else {
callback.invoke("message is null");
}
}
Is this page helpful?