title: fetching the drawing done on canvas using getRootView
body: <p>I am using <code>MyView</code> for drawing content on a canvas using <code>FingerPaint API</code> demo app. I want to capture whatever I have written on the canvas. But when I use <code>View v1 = myview.getRootView()</code> it is returning only the blank canvas and not the content. I want to save my drawing in SDCard. Following is my code. Let me know what do i need to change</p>
  
  <pre><code>v1 = myview.getRootView();
  System.out.println("v1 value = "+v1);
  v1.buildDrawingCache(true);
  v1.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), 
             MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
  //v1.layout(0, 0, v1.getMeasuredWidth(), v1.getMeasuredHeight()); 
  v1.layout(0, 0, 100, 100); 
  
  //Bitmap b = Bitmap.createBitmap(v1.getDrawingCache());
  myview.mBitmap = Bitmap.createBitmap(v1.getDrawingCache());
  System.out.println("BITMAP VALue = "+myview.mBitmap);
  
  ByteArrayOutputStream bytes = new ByteArrayOutputStream();
  //b.compress(Bitmap.CompressFormat.JPEG, 40, bytes);
  File f = new File(Environment.getExternalStorageDirectory()+ File.separator + "test.jpg");
  try {
      f.createNewFile();
      FileOutputStream fo = new FileOutputStream(f);
      fo.write(bytes.toByteArray());
  } catch (Exception e) 
  {
      e.printStackTrace();
  }
  v1.setDrawingCacheEnabled(false);
  </code></pre>
  
  <p><code>myview</code> is an object of class <code>MyView</code> that extends <code>View</code>.</p>