Android Question Application stopped. Where to find?

rosippc64a

Active Member
Licensed User
Longtime User
Hi All,
I have a big application, what
- if I set wifi on, but no connection
- only in release mode
can thow an exception:
Unfortunately, XXXXX has stopped.
In debug mode there is no error. If wifi connects to a router, no error.
The full error log looks like:
B4X:
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean anywheresoftware.b4a.BA.isActivityPaused()' on a null object reference
    at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:104)
    at android.os.Handler.handleCallback(Handler.java:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at android.os.Looper.loop(Looper.java:207)
    at android.app.ActivityThread.main(ActivityThread.java:5737)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
It is very strange error for me, because I can't figure out what is the relation to my code and looks as If originated deeper as any of my code resides in *.bas.
I search out the *.java (objects/src) files also, but didn't find isActivityPaused().

How can I find the real reason of this error? (yes, I tried log messages at wifi-related lines, but no luck)

thanks in advance
Steven
 
Last edited:

rosippc64a

Active Member
Licensed User
Longtime User
My pause code.
This error happen when my program starts. There is a splash screen timer, but it isn't related with wifi connection, and if I did a log before and after the timer code, the error happened always after the timer (after the timer code runs at least about 10 times):
B4X:
Sub TimerSplash_Tick
Log("Timer starts")
    intFadeCount = intFadeCount + 3
    obj1.RunMethod2("setAlpha", Min(intFadeCount, 255), "java.lang.int")
    ' the difference between 314 and 254 is for a delay before lauch NewActivity
    If intFadeCount > 314 Then
        FadeTimer.Enabled = False
        Activity.RemoveAllViews
        Activity.LoadLayout("formmain")
        dnNewVerAPK
        'ha menet közben éles lenne, akkor is változik a háttér!
        Codebase.setBGPict(Activity,Codebase.selceg.demo)
        fejlec
        Codebase.setMenuBtnColor(Array As Object(btnLekerdez,btnNavtest,btnSzamlaz,btnTorzsek,btnCegValtas))

        SplahOk = True
    End If
    log("Timer ends")
End Sub
Pause code:
B4X:
Sub Activity_Pause (UserClosed As Boolean)
    If UserClosed Then
        StopService("svchatter")
        If Codebase.sql.IsInitialized Then Codebase.sql.Close
        If Codebase.sql1.IsInitialized Then Codebase.sql1.Close
        Log("SQL closed. *********************************")
    End If
End Sub
And more interesting is the short error log. When a normal program makes an exception, there are always a long error log, a sequence of calling list, not so short.
 
Upvote 0

rosippc64a

Active Member
Licensed User
Longtime User
I thought that 'Attempt to invoke virtual method 'boolean anywheresoftware.b4a.BA.isActivityPaused()' on a null object reference' means that the b4a.BA will be null, so my activity doesn't exists anymore, but I don't know why?
 
Upvote 0

rosippc64a

Active Member
Licensed User
Longtime User
Thank you for the thinking together!
The error happens in emulator too, so I am close to a solution, what is in a service, deep in my code.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…