I have some custom BitmapStorage class that is not tied to either view or to another utility. And I have a born_animation.xml file that contains <animation-list> with animation frames:
<animation-list oneshot="true" > <item drawable="@drawable/frame01" /> <item drawable="@drawable/frame02" /> </animation-list>
I want to load the animation from an xml file as an AnimationDrawable using the Resource class (so that it will do all the parsing for me), extract the bitmaps and put them in my own storage class.
I have a problem:
Resources res = context.getResources(); AnimationDrawable drawable = (AnimationDrawable)res.getDrawable(R.drawable.born_animation); assertTrue( drawable != null ); <= fails! it null
WTF? Can someone explain this to me? The code compiles fine. All resources are available.
I tried another way - use ImageView for parsing (as described in dev manual)
ImageView view = new ImageView(context); view.setBackgroundResource(R.drawable.born_animation); AnimationDrawable drawable = (AnimationDrawable)view.getBackground(); assertTrue( drawable != null ); <= fails! it null
The results are the same. it returns a null value.
Any hinsts would be greatly appreciated, thanks in advance.
source share