SAK
SAK

Reputation: 21

Invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference" on my webview app

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.icche.newspaper, PID: 5318 java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at com.android.webview.chromium.WebViewContentsClientAdapter.getDefaultVideoPoster(WebViewContentsClientAdapter.java:1164) at org.chromium.android_webview.DefaultVideoPosterRequestHandler$1.run(DefaultVideoPosterRequestHandler.java:39) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5351) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:947) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)

Upvotes: 2

Views: 3727

Answers (1)

user2342558
user2342558

Reputation: 6728

The error says that at line 1164 of WebViewContentsClientAdapter.java, you are trying to invoke the method getWidth() on a null Bitmap Object.

Check that Bitmap for null before invoke that method, and debug why it is null (with Log.d() or with Toast.makeText(...))

Upvotes: 0

Related Questions