How to capture a screenshot of a whole View

Welcome to ScriptMode
Rami
Posts: 36
Joined: Tue Aug 25, 2015 9:39 am

How to capture a screenshot of a whole View

Postby Rami » Wed Mar 02, 2016 7:11 am

I have built a table which is basically done by HorizontalScrollView inside a ScrollView. I made the user can edit the fields.

Now I want to save the table on a screen, jpg, png, pdf or anything else.

The problem is - the table is nearly always bigger than the screen.

Is it possible to take screenshot of the whole view.

Paul
Posts: 137
Joined: Mon Aug 24, 2015 4:53 pm

Re: How to capture a screenshot of a whole View

Postby Paul » Fri Mar 04, 2016 1:26 pm

Using @softwaresupply answer causes problem in my case where my view was getting redrawn and getting completely white. There is an easier solution to get screenshot where you don't even have to supply width and height as parameters. Use Drawing Cache.

public static Bitmap loadBitmapFromView(View v) {
Bitmap bitmap;
v.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v.getDrawingCache());
v.setDrawingCacheEnabled(false);
return bitmap;
}


Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest