title: Drawing a Drawable to a Bitmap
body: <p>I have an XML drawable file with a stroke, and I also have several bitmaps which I want to apply the stroke to.  I tried calling Drawable.draw(canvas), but it throws IllegalStateException</p>
  
  <p>stroke XML:</p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
         android:shape="rectangle"&gt;
      &lt;stroke android:width="3dp"
              android:color="#ffffffff"/&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>Drawing code:</p>
  
  <pre><code>Drawable strokeDrawable = getResources().getDrawable(R.drawable.stroke);
  Bitmap bmp1 = BitmapFactory.decodeResource(getResources(), R.drawable.bmp1);
  Canvas canvas = new Canvas(bmp1);
  strokeDrawable.draw(canvas);
  </code></pre>
  
  <p>How should I do this?</p>