After updating to 8.0 we get a crash so far we haven\'t seen before:
java.lang.NullPointerException: Attempt to invoke virtual method \'int android.graphics.
Thanks to @breakline's answer, I got this issue worked around! Thanks! But instead of using decoding a bitmap, I just create an empty one and return that:
setWebChromeClient(new WebChromeClient() {
@Override
public Bitmap getDefaultVideoPoster() {
return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
}
});
Anyone still wondering instead of downvoting here is the actual fix to this. Since I spent quite some time on this I will post it here.
You need to add the following to your WebChromeClient:
webview.setWebChromeClient(new WebChromeClient() {
@Override
public Bitmap getDefaultVideoPoster() {
Bitmap icon = BitmapFactory.decodeResource(context.getResources(), R.drawable.black);
return icon;
}
});
Any drawable is fine as long as it is an actual PNG file. If you use a drawable/xml you still get an exception.