title: How to change drawable background color from code (Java/Kotlin) file
body: <p>I have created following drawable and set it to a button background from code.</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
      &lt;corners android:radius=&quot;8dp&quot;/&gt;
      &lt;solid android:color=&quot;@color/background_profile&quot;/&gt;
      &lt;padding android:left=&quot;8dp&quot; android:top=&quot;7dp&quot; android:right=&quot;8dp&quot; android:bottom=&quot;6dp&quot; /&gt;
  &lt;/shape&gt;
  </code></pre>
  <p><strong>Kotlin File</strong></p>
  <pre><code>  btn?.background= resources?.getDrawable(R.drawable.drawable_rewards)
  </code></pre>
  <p>Now i will be getting color from my service, like this <code>&quot;#00000&quot;</code>, and I need to update the color in <code>drawable_rewards.xml</code> file.</p>
  <p>Is there any way we can change color of drawable file dynamically.</p>