Changing imageview on button click android
<p>I'm attempting to to change the image when the button is clicked. In the learning curve at the moment so having trouble identifying why its failing.</p>

<p>Here's my code:</p>

<pre><code>public class Main extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


    Button changeMebtn = (Button) findViewById(R.id.changeMe);

    changeMebtn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            ImageView image = (ImageView) findViewById(R.drawable.amsterdam);
            image.setImageResource(R.drawable.lima);
        }
    });


}
</code></pre>

<p>}</p>

<p>XML:</p>

<pre><code> &lt;ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/amsterdam" /&gt;

    &lt;Button
        android:id="@+id/changeMe"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Change Me" 
        android:layout_gravity="center"/&gt;
</code></pre>

<p>I'm currently getting an generic error when i click the button.</p>

<p>Can somebody tell me what i'm doing wrong here...?</p>

<p>Thanks.</p>
