0
如何獲取網頁截圖的截圖,如果它太長,並將其存儲在內部存儲。因此,例如,如果我的webview顯示「google.com」,並且我嘗試下面的代碼,它會截取屏幕截圖並將其存儲爲.jpg。但如果我的webview顯示「stackoverflow.com」,由於這個網頁太長,應用程序崩潰。一些幫助將不勝感激。長網頁的Android截圖
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)
{
}
我希望從一個長的WebView創建多個圖像,並將其存儲在一個文件夾或文件。 – user1932345