Simple Custom Action

Creating and executing a custom action

To create your custom action, follow the next steps:

  1. Create an annotated class with @RegisterAction that implements an Action interface;
  2. After that, the interface will request to implement the execute method;
  3. Now, declare the action result.

The value attribute is a parameter example that can be declared in this class constructor. The following example shows an action with Toast receiving a text with a parameter:

data class CustomActionAndroid(
    val value: String
) : Action {
    override fun execute(rootView: RootView) {
  • See below an action example in a button type component:
   text = text,
   styleId = styleId,
   onPress = listOf(CustomActionAndroid("I'm a customized action"))

Last modified February 11, 2021: create content (#298) (43225e15)