I have an android AnimationDrawable
which contains a large animation.(24 frame each 100x100 pixels). I want to show this animation in multiple views with different sizes, simultaneously and synchronously. I mean when view1 is showing frame1, all other views must show frame1 too, and all views are visible at the same time.
I tried creating an AnimationDrawable
, and used it as background drawable of multiple views and used animationdrawable.start(). But after this, only one of my views animate and others stay at frame1.
I have seen these threads
Single Animation - Multiple Views
and
Apply one animation to multiple views at the same time
but the answers all included creating multiple instances of animations. I should avoid this because loading the animation multiple times uses a lot of memory since the animation is large.
I was wondering if anyone has an idea of how is it achievable?
PS> I also tried using static bitmaps as drawables but resizing it for each view needs synchronization and increases CPU usage a lot.
I would appreciate any other method for implementing this beside using AnimationDrawable
.
A side question: does android use-up memory each time we use a resource? For example if i create 20 ImageViews and set their resources to R.drawable.mydrawable, is the memory used equal to 20 * memory_used_for_decoding_mydrawable?