title: How to change ImageView source programatically several times?
body: <p>Once the image is pressed, it changes and plays a sound. After the sound is played I would expect to return to the previous image (same ImageView), which isn't happening.</p>
  
  <p>xml code:</p>
  
  <pre><code>&lt;ImageView
      android:id="@+id/imageView_red_off"
      android:src="@drawable/red_orig"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:adjustViewBounds="true"
      android:maxHeight="160dp"
      android:maxWidth="150dp"
      android:layout_gravity="top|left"
      android:paddingRight="40dp"
      android:paddingLeft="0dp"
      android:scaleType="fitCenter"
  /&gt;
  </code></pre>
  
  <p>java code:</p>
  
  <pre><code>public boolean onTouch(View view, MotionEvent event) {
  .
  .
  .
  
      if (event.getAction() == MotionEvent.ACTION_DOWN) {
          if (colorRed &gt; threshold)) {
              whatColor = "Red";
              imageRed.setImageResource(R.drawable.red);
          }
     .
     .
     .
     }
  
  playSound(whatColor);
  imageRed.setImageResource(R.drawable.red_orig);
  .
  .
  .
  }
  </code></pre>
  
  <p>in playsound method:</p>
  
  <pre><code>if ((color != "None")) {
      MediaPlayer mp = MediaPlayer.create(this, animal);
      mp.start();
      mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
          public void onCompletion(MediaPlayer mp) {
              mp.release();
          };
      });
  }
  </code></pre>
  
  <p>Thanks.</p>