title: Android image rotate via xml file
body: <p>I've been attempting to make a image file rotate on the spot and am struggling, every tutorial I find seems to do this in a different way.</p>
  
  <p>Can someone point where I'm going wrong here. </p>
  
  <p>GamePlay.java</p>
  
  <pre><code>import android.app.Activity;
  import android.graphics.drawable.AnimationDrawable;
  import android.os.Bundle;
  import android.widget.ImageView;
  
  public class GamePlay extends Activity {
  
   /** Called when the activity is first created. */
   @Override public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.gameplay);
  
   ImageView logo = (ImageView)findViewById(R.id.mainlogo);
   logo.setBackgroundResource(R.anim.rotate);
  
   AnimationDrawable frameAnimation = (AnimationDrawable) logo.getBackground();
  
   frameAnimation.start();
  
   }
  }
  </code></pre>
  
  <p>rotate.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;rotate xmlns:android="http://schemas.android.com/apk/res/android"
  android:pivotX="50%" 
  android:pivotY="50%" 
  android:fromDegrees="0"
  android:toDegrees="360" 
  android:drawable="@drawable/logo" /&gt;
  </code></pre>
  
  <p>gameplay.xml
      
  </p>
  
  <pre><code>&lt;ImageView
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content"
      android:id="@+id/mainlogo"
      android:src="@drawable/logo"&gt;       
  &lt;/ImageView&gt;
  </code></pre>
  
  <p></p>