title: Android - Convert Canvas to Bitmap
body: <p>Is it possible to convert a Canvas to a Bitmap before draw? I've override onMeasure of my Custom View to implement scrolling. Canvas has shown correctly, I'd like to convert it in a bitmap for enhance speed of scrolling but using these statements</p>
  
  <pre><code>Bitmap bitmap = Bitmap.createBitmap(this.getMeasuredWidth(),this.getMeasuredHeight(),bitmap.Config.ARGB_8888); 
  Canvas canvas = new Canvas(bitmap);
  </code></pre>
  
  <p>Log cat says</p>
  
  <pre><code>09-15 21:54:36.926: E/AndroidRuntime(28919): FATAL EXCEPTION: main
  09-15 21:54:36.926: E/AndroidRuntime(28919): java.lang.RuntimeException: Unable to start activity     ComponentInfo{zardoni.matteo.timeline/zardoni.matteo.AppAndroid.Activities.TimelineActivity}: java.lang.IllegalArgumentException: width and height must be &gt; 0
  </code></pre>
  
  <p>Is there a way to convert the Canvas into a Bitmap via createBitmap() without know width/height? I know this values only after finish drawing on the Canvas.</p>
  
  <p>Thanks</p>