title: How to retrieve drawable from attributes reference
body: <p>I defined theme and style inside my app. icons (drawable) are defined using reference in style file as</p>
  
  <pre><code>&lt;attr name="myicon" format="reference" /&gt;
  </code></pre>
  
  <p>and style as</p>
  
  <pre><code>&lt;style name="CustomTheme" parent="android:Theme.Holo"&gt;
      &lt;item name="myicon"&gt;@drawable/ajout_produit_light&lt;/item&gt;
  </code></pre>
  
  <p>I need to retrieve the drawable programmatically to use the good image in a dialogfragment.
  If I make like</p>
  
  <pre><code>mydialog.setIcon(R.style.myicon);
  </code></pre>
  
  <p>I get an id equals to 0, so no image</p>
  
  <p>I tried to use something like</p>
  
  <pre><code>int[] attrs = new int[] { R.drawable.myicon};
  TypedArray ta = getActivity().getApplication().getTheme().obtainStyledAttributes(attrs);
  Drawable mydrawable = ta.getDrawable(0);
  mTxtTitre.setCompoundDrawables(mydrawable, null, null, null);
  </code></pre>
  
  <p>I tried different things like that but result is always 0 or null :-/</p>
  
  <p>How I can I do this ?           </p>