I am new to android programming and am trying to rotate an image.
This is my code:
public class MainActivity extends Activity {
ImageView x;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
x = (ImageView)findViewById(R.drawable.clippedneedle);
RotateAnimation newAnim = new RotateAnimation(0,360);
newAnim.setFillAfter(true);
newAnim.setDuration(10);
x.startAnimation(newAnim);
}
}
My layout file is standard and just contains code from an ImageView.
Basically, my program stops running as soon as it opens. The logcat says that the thread is exiting with uncaught exception.
Any help would be much appreciated. Thanks!