rive-app / rive-android

A runtime for interactive animations on Android
https://rive.app
MIT License
332 stars 30 forks source link

How to set url from java file i mean programmatically set url to RiveAnimationView? #304

Closed piyush85730 closed 9 months ago

HayesGordon commented 9 months ago

Hi @piyush85730 you'll need to load the HTTP file and set the resource with animationView.setRiveBytes

You can find an example here: https://github.com/rive-app/rive-android/blob/master/app/src/main/java/app/rive/runtime/example/HttpActivity.kt

HayesGordon commented 9 months ago

Going to close this issue, but feel free to reopen. Also be sure to reach out to the team on Discord if you have implementation questions where we can help out with similar issues.

HayesGordon commented 9 months ago

To avoid confusion, the above is only recommended if you want to programatically update your Rive animation through code (loaded from a URL). The easiest way is to instead set the URL once off through XML - see Add RiveAnimation to your XML layout