title: Change Android Drawable Button Icon Programmatically
body: <p>How would one change the <code>android:src</code> XML property programatically of a FloatingActionButton or Button widget? I have a button defined as following within an activity:</p>
  
  <pre><code>FloatingActionButton floatingActionButton = (FloatingActionButton) this.findViewById(R.id.start_button);
  </code></pre>
  
  <p>It has an initial <code>android:src</code> set as follows:</p>
  
  <pre><code>android:src="@android:drawable/ic_media_play"
  </code></pre>
  
  <p>I'm trying to utilize the <a href="https://developer.android.com/reference/android/widget/ImageView.html#setImageResource(int)" rel="noreferrer">setImageResource(int id)</a> to change the <code>android:src</code> XML property, but how to I access a Drawable icon such as <code>ic_media_pause</code> after a button click that occurs for example. When I try to pass in <code>R.drawable.ic_media_pause</code> to the <code>setImageResource()</code> method I received an cannot resolve symbol error.</p>
  
  <p><code>floatingActionButton.setImageResource(R.drawable.ic_media_pause);</code></p>
  
  <p>How do I get at the available <a href="https://developer.android.com/reference/android/R.drawable.html#ic_media_play" rel="noreferrer">R.drawable</a> resources to pass it in as an argument.</p>
  
  <p>Any help would be great appreciated. Thank you!</p>