title: How to get the color of a Drawable in Android
body: <p>in one part of my code I have the following code:</p>
  
  <pre><code>linearLayout.setBackgroundColor(Color.RED);
  </code></pre>
  
  <p>In the other part I want to get the background color that was set, something like:</p>
  
  <pre><code>linearLayout.getBackgroundColor();
  </code></pre>
  
  <p>But there is no method like this, there is only this method:</p>
  
  <pre><code>Drawable drawable = linearLayout.getBackground();
  </code></pre>
  
  <p>How can I get the color of a drawable? (I don't want to extend the LinearLayout and manually storing the background color etc.)</p>