title: Not able to make a button change color ONLY while clicked (Android)
body: <p>I want a button to change color when it's pressed, then change back to its original color when its released. Currently I have a button that takes you to a fragment when pressed. I tried simply using </p>
  
  <pre><code>button.setBackgroundColor(Color.BLUE);
  </code></pre>
  
  <p>in the button's onClickListener but realised that when it took me to the fragment and I returned to the activity, the button is still the same color and hasn't changed back. So my plan of action is to change it's color when its pressed, launch the fragment, then set the button's color to how it originally was so that if I press back the button appears to be as normal (unclicked). </p>
  
  <p>However, I cannot seem to find an example online that shows me to GET the color of a button as an int (so I can use setBackgroundColor(int)). Any ideas?</p>
  
  <p>Highly grateful for any help</p>