I have a custom class that extends the View class. How can I draw a GIF behind other things I am drawing on Canvas in the onDraw method?
I got the solution by Movie class is deprecated and I didn't able to find their dependency:
I get the similar stackoverflow question this, I followed their step and got error that i didn't understand and my app got crash, here the error
Since you didn't share any code my answer is very high level too.
You can use android.graphics.drawable.AnimatedImageDrawable (for API >= 28) and android.graphics.Movie (for API < 28).
Both classes have a draw()
method that draws on the given Canvas
.
Don't forget to call setBounds()
in case you use the AnimatedImageDrawable
.