I got a function takes screenshot only visible screen, not taking full WebView screenshot.
It does not give hidden or scrolled content, just take snap of current view.
Here is my code.
public File getBitmapFromwebchartView(WebView view2) {
if (view2 != null) {
view2.setDrawingCacheEnabled(true);
Bitmap b = view2.getDrawingCache();
if (b != null) {
try {
//File fi = new File(Environment.getExternalStorageDirectory(), "Screenshot" + ".jpg");
fi = new File(Environment.getExternalStorageDirectory(),"Realitycheck" + ".jpg");
// write the bytes in file
FileOutputStream fo;
fo = new FileOutputStream(fi);
b.compress(CompressFormat.JPEG, 100, fo);
} catch (Exception e) {
e.printStackTrace();
}
}
}
return fi;
}