I have a custom WebView
and I want to get a bitmap of its content (offscreen included). I used this code, which I got from here:
public static Bitm
Quick fix:-
Set android:largeHeap="true" in your AndroidManifest.xml file.
<application
android:name="yourapplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher_rounded"
android:label="@string/app_name"
android:largeHeap="true"
android:roundIcon="@mipmap/ic_launcher_rounded"
android:supportsRtl="true"
android:theme="@style/AppTheme">
Gud luck :)
Okay, I've cracked this one meself. The problem indeed was in the fact that the function returned the Bitmap
waay before the zooming out procedure was over, so I had to delay it.
I incorporated
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
//bulk of my code
}
}, 1000);
which forced to change the structure of the function from public Bitmap
to public void
. Here's directly related thread. Despite some minor tweaks I still need to fix, the approach works like a charm