title: Having trouble changing image on imageButton at run time
body: <p>I'm trying to update the image of an imageButton on run time.  I have a switch statement that checks for an ID passed from another activity.  I know the switch statement is working as the correct ID is passed to the TextView.</p>
  
  <p>I've been searching and see some examples use the ImageView and others use the ImageButton.  As you can see below I've tried both and none work.  </p>
  
  <p>XML Layout:</p>
  
  <pre><code>    &lt;ImageButton android:visibility="gone" android:id="@+id/imageButton" android:src="@drawable/defaultimage" android:layout_width="97dp" android:layout_height="95dp"&gt;&lt;/ImageButton&gt;
      &lt;TextView android:visibility="gone" android:text="TextView" android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true"&gt;&lt;/TextView&gt;
  </code></pre>
  
  <p>Java Code:</p>
  
  <pre><code>    case 1:{
              // Location 1
              ImageView ImageButton = (ImageView)findViewById(R.id.imageButton);
              ImageButton .setImageResource(R.drawable.image1);
              ImageButton .setVisibility(0);
              TextView Test = (TextView)findViewById(R.id.textView);
              Test.setVisibility(0);
              Test.setText("ID passed is" + id);
              break;
              }
          case 2:{
              // Location 2
              ImageButton ImageButton = (ImageButton)findViewById(R.id.imageButtonGhostCamLocation);
              ImageButton .setBackgroundResource(R.drawable.image2);
              ImageButton .setVisibility(0);
  
              TextView Test = (TextView)findViewById(R.id.textView);
              Test.setVisibility(0);
              Test.setText("ID passed is" + id);
              break;
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Got it to work!  I just removed the android src from the ImageButton in xml layout and it's working fine now.  Thanks for the help!</p>