Android Question java error

Devv

Active Member
Licensed User
Hello
i published one app to google play

i found on the developer console that there is one device that faced the following error

java.lang.NullPointerException:

at com.beisat.android.main._activity_keypress (main.java:403)

at java.lang.reflect.Method.invoke (Native Method)

at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:191)

at com.beisat.android.main$HandleKeyDelayed.runDirectly (main.java:230)

at com.beisat.android.main$HandleKeyDelayed.run (main.java:227)

at android.os.Handler.handleCallback (Handler.java:751)

at android.os.Handler.dispatchMessage (Handler.java:95)

at android.os.Looper.loop (Looper.java:154)

at android.app.ActivityThread.main (ActivityThread.java:6776)

at java.lang.reflect.Method.invoke (Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1518)

at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
any idea what this may be ?
 

Brandsum

Well-Known Member
Licensed User
Goto your Project > Objects folder > src folder > explore until you see java files

Open main.java and goto line 403 to check why the error occurred.
 

Devv

Active Member
Licensed User
Can you post the Activity_KeyPress code?
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
    If KeyCode  = KeyCodes.KEYCODE_BACK Then 'if double pressed {exit} or single pressed {return}
        If WebView_Main.tag = "https://beisat.com/" & Starter.language & "/" Or WebView_Main.tag = "https://beisat.com/" & Starter.language & "/" Then
            Timer_exit.Interval = 2000
            Timer_exit.Enabled = True
            backButtonCounter = backButtonCounter + 1
            If backButtonCounter > 1 Then
                CloseActivities
            End If
            ToastMessageShow(translator.translate("Press Back button again to exit"), False)
        Else
            WebView_Main.onBackPressed 'go to prevoius web page
            Timer_exit.Interval = 500
            Timer_exit.Enabled = True
            backButtonCounter = backButtonCounter + 1
            If backButtonCounter > 1 Then
                CloseActivities
            End If
            grayer
        End If
        Return True
    Else
        Return False
    End If
End Sub
 

Devv

Active Member
Licensed User
The Java code doesn't match the error message. It was probably compiled at a later point.

There are several possible causes. Maybe the back key was pressed before translator was initialized.
ok will try that

thanks
 
Top