Below is my code, this closes the app as I have set the image in my class. What seems wrong with this? Easier way to load the image?
public static class FiveSkills extends Activity{
ImageView img = (ImageView) findViewById(R.id.img);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.image);
img.setImageResource(R.drawable.five_skills);
}
}
XML Layout
<?xml version="1.0" encoding="utf-8"?>
<ImageView
android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="59dp"
/>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="15dp"
android:text="Five Skills"
android:textColor="#08088A"
android:textAppearance="?android:attr/textAppearanceLarge" />