Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion runtimes/android/data-binding.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,27 @@ import { Demos } from "/snippets/demos.jsx";
// Clean up external file when done
externalFile.dispose()
```

You can also create a bindable artboard with a view model instance to control its state.

```kotlin
// Create the view model instance for the child artboard.
val childVmi = childFile.getViewModelByName("ChildVM").createBlankInstance()
val bindableArtboard = childFile.createBindableArtboardByName("Child", childVmi)

// Get the artboard property from the main artboard.
val vmi = rive.file!!.firstArtboard.viewModelInstance!!
val artboardProperty = vmi.getArtboardProperty("Artboard property")

// Set the bound artboard VMIs state.
childVmi.getNumberProperty("rotation").value = 90f

// Set the bound artboard on the main artboard.
artboardProperty.set(bindableArtboard)

// Release the reference we hold from creation.
bindableArtboard.release()
```
</Tab>
</Tabs>

Expand Down Expand Up @@ -544,4 +565,4 @@ import { Demos } from "/snippets/demos.jsx";
<Tab title="Legacy">
See the [data binding overview example](https://github.com/rive-app/rive-android/blob/master/app/src/main/java/app/rive/runtime/example/LegacyDataBindingActivity.kt).
</Tab>
</Tabs>
</Tabs>