0

we do app:lottie_rawRes="@raw/great" to fetch lottie file but how can we do it in java to fetch lottie file like that as of XML? I tired to do many things but could not solve that. how can I get that?

Dibas Dauliya
  • 639
  • 5
  • 20

1 Answers1

1

Setting up the animation from the xml file can be done in 2 ways:

by using app:lottie_fileName=”motorcycle.json”
or app:lottie_rawRes=”@raw/motorcycle”.

The code equivalent of the first is this:

av_from_code.setAnimation("motorcycle.json")

Note that your animaniton file must be in your assets folder.

evgenipc
  • 26
  • 6