Getting a RotateDrawable from XML results in crash
<p>I'm trying to retrieve a RotateDrawable defined in XML but it causes an excetion when I call getDrawable(). Here are my XML and java files:</p>

<p>square.xml</p>

<pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt; 
&lt;shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle" 
    android:id="@+id/mysquare"&gt;
    &lt;solid android:color="#0000f8"/&gt;
    &lt;size android:height="200dp" android:width="200dp"&gt;&lt;/size&gt;
    &lt;padding android:top="0dp"&gt;&lt;/padding&gt;
&lt;/shape&gt;
</code></pre>

<p>myrotate.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;rotate xmlns:android="http://android.com/apk/res/android" 
        android:drawable="@drawable/square"
        android:fromDegrees="0"
        android:toDegrees="45"
        android:pivotX="50%"
        android:pivotY="50%"&gt;&gt;
        &lt;/rotate&gt;
</code></pre>

<p>Indicator.java (only relevant code shown)</p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //setContentView(R.layout.main);
    setContentView(R.layout.drawablelayout);
    Button b = (Button)findViewById(R.id.btnAnimate);
    b.setOnClickListener(this);
    r = getResources();

    /* this is where the exception happens */
    RotateDrawable rt = (RotateDrawable) r.getDrawable(R.drawable.myrotate);


}
</code></pre>

<p>Can anyone tell me how I'm supposed to get a RotateDrawable from XML?</p>
