Android Question Null pointer exception on webview

focus330

Member
Licensed User
Longtime User
I have an app published that crashes few times with this code;

B4X:
java.lang.NullPointerException
    at android.webkit.WebViewClassic$PrivateHandler.handleMessage(WebViewClassic.java:12985)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:176)
    at android.app.ActivityThread.main(ActivityThread.java:5365)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
    at dalvik.system.NativeStart.main(Native Method)

I use webview in a simple mode, that is I display an HTML page loaded with this code:
B4X:
    Dim s As String
    s = "file://" & File.DirInternalCache & "/advert.htm"
    If File.Exists (File.DirInternalCache,"advert.htm") = True Then
        WebView1.LoadURL(s)  
    End If

The error occurs sometimes with 4.1 4.2 and 4.3 Android versions. Other versions seem to run correctly.

Note that in the activity there are only two buttons and nothink more.

Can someone help me ? Thanks
 
Last edited:
Top