title: How to retrieve a view's background color and compare it to a color resource
body: <p>I'm trying to compare whether the background color of one of my views is equal to a color resource I created and haven't found anything that works.</p>
  
  <p>I'm willing to use any method, whether converting to HEX or String or Int, as long as it works. Here's an example of my current method.</p>
  
  <p>I set the background color of a view with:</p>
  
  <pre><code>chosenColor.setBackgroundColor(getResources().getColor(R.color.tag_pink));
  </code></pre>
  
  <p>When I retrieve it using this method:</p>
  
  <pre><code>ColorDrawable chosenColorBox = (ColorDrawable) chosenColor.getBackground();  
  int colorId =  chosenColorBox.getColor();
  
  colorId == `-611329` 
  </code></pre>
  
  <p>Using <code>Integer.toString</code> on <code>R.color.tag_pink</code> shows the value as <code>2130968581</code> which obviously can't be compared in an <code>if</code> statement" with the retrieved value.</p>
  
  <p>What's the best way to do this so I don't have to resort to hard-coding the individual values, which prevents me from adjusting the color resources?</p>