Here you can find the source of saveBitmapFromScrollView(ScrollView scrollView, String path)
public static Bitmap saveBitmapFromScrollView(ScrollView scrollView, String path)
//package com.java2s; import java.io.FileOutputStream; import android.graphics.Bitmap; import android.graphics.Canvas; import android.widget.ScrollView; public class Main { public static Bitmap saveBitmapFromScrollView(ScrollView scrollView, String path) {/*from ww w . jav a 2 s. c om*/ int h = 0; Bitmap bitmap = null; for (int i = 0; i < scrollView.getChildCount(); i++) { h += scrollView.getChildAt(i).getHeight(); } bitmap = Bitmap.createBitmap(scrollView.getWidth(), h, Bitmap.Config.ARGB_8888); final Canvas canvas = new Canvas(bitmap); scrollView.draw(canvas); FileOutputStream out = null; try { out = new FileOutputStream(path); if (out != null) { bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); out.flush(); out.close(); } } catch (Exception e) { return null; } return bitmap; } }