title: Screenshot of a webpage with Flash elements
body: <p>I would like to take a screenshot of a page displayed in a WebView. The page contains flash elements - and here is the problem. When I take a screenshot all the flash parts of the page are blank.</p>
  
  <p>I am using this piece of code to take a screenshot:</p>
  
  <pre><code>WebView webView = (WebView) findViewById(R.id.webview);
  Picture picture = webView.capturePicture();
  Bitmap screenshot = Bitmap.createBitmap(picture.getWidth(),
          picture.getHeight(), Bitmap.Config.ARGB_8888);
  Canvas c = new Canvas(screenshot);
  picture.draw(c);
  
  File file = new File("/sdcard/screenshot.jpg");
  FileOutputStream ostream = null;
  try {
      file.createNewFile();
      ostream = new FileOutputStream(file);
      screenshot.compress(CompressFormat.JPEG, 90, ostream);
      Log.d("Test", "Screenshot taken");
  } catch (Exception e) {
      Log.e("Test", "Error", e);
  } finally {
      try {
          ostream.close();
      } catch (IOException ignore) {
      }
  }
  </code></pre>
  
  <p>I was also trying to acquire <code>Bitmap</code> of the screen contents using the solution given in <a href="https://stackoverflow.com/questions/5939987/android-take-screenshot-via-code/5940832#5940832">this SO question</a>:</p>
  
  <pre><code>View webView = findViewById(R.id.webview);
  Bitmap bitmap = webView.getDrawingCache();
  </code></pre>
  
  <p>This also doesn't work - the result is the same (i.e. blank flash elements).</p>
  
  <p>So the question is: <strong>How to take a screenshot of WebView contents also with flash elements?</strong></p>