title: Changing color in a shape inside a layer-list programmatically
body: <p>I am trying to change programmatically the color of the <strong>selectable_kachel_shape</strong>. Here is the xml file:</p>
  
  <p><strong>kachel_ticked_style.xml</strong></p>
  
  <pre><code>&lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
  
      &lt;item&gt;
          &lt;shape
              android:id="@+id/selectable_kachel_shape"
              android:shape="rectangle" &gt;
              &lt;stroke
                  android:width="5dp"
                  android:color="@color/headrbar_color" /&gt;
          &lt;/shape&gt;
      &lt;/item&gt;
      &lt;item&gt;
          &lt;rotate
              android:fromDegrees="45"
              android:pivotX="120%"
              android:pivotY="100%"
              android:toDegrees="45" &gt;
              &lt;shape android:shape="line" &gt;
                  &lt;stroke
                      android:width="40dp"
                      android:color="@color/headrbar_color" /&gt;
              &lt;/shape&gt;
          &lt;/rotate&gt;
      &lt;/item&gt;
      &lt;item
          android:right="5dp"
          android:top="5dp"&gt;
          &lt;bitmap
              android:gravity="top|right"
              android:src="@drawable/selectable_tiles_check" /&gt;
      &lt;/item&gt;
  
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>I am calling inside a Fragment the following code</p>
  
  <pre><code>LayerDrawable layers = (LayerDrawable)  this.getActivity().getResources().getDrawable(R.drawable.kachel_ticked_style);
  
  GradientDrawable shape = (GradientDrawable) (layers.findDrawableByLayerId(R.id.selectable_kachel_shape));
                         shape.setColor(this.getActivity().getResources().getColor(android.R.color.background_dark);
  </code></pre>
  
  <p>1.Why am I geting a NullPointerException in <strong>shape.setColor</strong>?</p>
  
  <p>2.How would it be possible to change the color inside a shape, that is inside a layer list, programmatically?</p>