renderWidget
Use the renderWidget API to create and render view compontents based on templates.
Method signature
The following code shows the method signature of the renderWidget API:
fun renderWidget(
input: SpacePullInfo,
containerView: ViewGroup,
actionDelegate: WidgetActionDelegate,
completion: WidgetRenderCallback?=null
)Request parameters
Name | Type | Description |
input | A | |
containerView | ViewGroup | A pre-allocated |
actionDelegate | WidgetActionDelegate |
|
completion | WidgetRenderCallback | A callback function. On success, |
Response parameters
N/A
Exception
Error Code | Error message |
1200 | A network error has occurred. |
1201 | A backend error has occurred. |
1202 | The user ID is empty. |
1203 | A response payload is unavailable. |
1400 | Parameters are invalid |
1500 |
|
Sample
Kotlin
ComponentManager.ASAP.getBusinessComponent()
.renderWidget(spacePullInfo, flRender, object :
WidgetActionDelegate {
override fun performAction(type: String?, data: Map<String, Any>?) {
//View click event callback
}
}, object : WidgetRenderCallback {
override fun onSuccess() {
}
override fun onFailure(code: Int, msg: String, throwable: Throwable?) {
}
})