How to load AnimationDrawable from xml file
<p>I have some custom class BitmapStorage, not attached to any View or whatever - an utility one. 
And I have born_animation.xml file which contains &lt;animation-list&gt; with animation frames:</p>

<pre><code>&lt;animation-list oneshot="true" &gt;
    &lt;item drawable="@drawable/frame01" /&gt;
    &lt;item drawable="@drawable/frame02" /&gt;
&lt;/animation-list&gt;
</code></pre>

<p>I want to load animation from xml file as an AnimationDrawable using Resources class (so it would do all the parsing for me), extract Bitmaps and put them to my custom storage class. </p>

<p>The problem i have: </p>

<pre><code>Resources res = context.getResources(); 
AnimationDrawable drawable = (AnimationDrawable)res.getDrawable(R.drawable.born_animation); 
assertTrue( drawable != null ); &lt;= fails! it's null 
</code></pre>

<p>WTF? Can someone explain me that? Code compiles fine. All resources are in place. </p>

<p>I tried another way - use ImageView to do the parsing (like described in dev guide) </p>

<pre><code>ImageView view = new ImageView(context); 
view.setBackgroundResource(R.drawable.born_animation); 
AnimationDrawable drawable = (AnimationDrawable)view.getBackground(); 
assertTrue( drawable != null ); &lt;= fails! it's null 
</code></pre>

<p>Results are the same. it returns the null drawable. </p>

<p>Any hinsts would be greatly appreciated, thanks in advance.</p>
