android screenshot for long webpage
<p>How to get screenshot of a webview if it too long and store it in internal storage. So for example if my webview shows "google.com" and i try below code it takes the screenshot and stores it as .jpg. But if my webview shows "stackoverflow.com", as this web page is too long, the app crashes. Some help will be appreciated. </p>

<pre><code>Picture picture=this.getCurrentWebView().capturePicture();
    Bitmap b = Bitmap.createBitmap(picture.getWidth(), picture.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas c = new Canvas(b);
    picture.draw(c); 
            FileOutputStream fos = null;  
            try {
                fos = new FileOutputStream("mnt/sdcard/myjpg.jpg"); 
                    if ( fos != null ){
                        b.compress(Bitmap.CompressFormat.JPEG, 100, fos);
                        fos.close();
                    }
                }
           catch( Exception e )
           {
           }
</code></pre>
