I want to have an imageView change the image it is displaying to a different one from my drawables. All the other methods that I have found an tried result in the app crashing. There 2 imageViews in the activity and I want to be able to change what both display, but independently from each other. I am new to Java scripting, so the simplest and most basic answer will help me the most.

Here is my XML:

```
<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:src="@drawable/a"
    android:contentDescription="@string/a_mode"
    android:onClick="startAMode" />

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:src="@drawable/p"
    android:contentDescription="@string/p_mode"
    android:onClick="startPMode" />

```

Here is my current Java script:

```
public class SelectorActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.activity_selector);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.selector, menu);
    return true;
}

public void startAMode(View view) {
    ImageView img = (ImageView) findViewById(R.id.imageView1);
    img.setImageResource(R.drawable.adown);
}

```

}

This doesn't work:

```
    public void startAMode(View view) {
    ImageView img = (ImageView) findViewById(R.id.imageView1);
    img.setImageResource(R.drawable.adown);
}

```