Invisible break point?

pleskina

Member
Licensed User
Longtime User
Hello,

Maybe I do not know something but there is one thing I can not get rid of when running an application in "debug" mode. I have the following line in my main activity:

If WayService.GPS1.GPSEnabled = False Then lblLocationStatus.Text = lblLocationStatus.Text & " (GPS disabled!)"

Every time program runs into this line, debugger stops on it as there is a break point, but there is not. However, application execution continues...

This is not really a showstopper, but I wonder what triggers it and if it can affect app behavior on some devices?

Sorry if I put the question wrong way, but this is my first so far... all others I found already answered! :)

Thanks!
Davor

debugger.png
 

pleskina

Member
Licensed User
Longtime User
Actually, there is (I must have been stupid not to look into the log):

If WayService.GPS1.GPSEnabled = False Then lblLocationStatus.Text = lblLocationStatus.Text & " (GPS disabled!)"
java.lang.NullPointerException


at anywheresoftware.b4a.gps.GPS.getGPSEnabled(GPS.java:128)
at advanceit.way_dev.main._update_status(main.java:1737)
at advanceit.way_dev.main._activity_resume(main.java:489)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:149)
at advanceit.way_dev.main.afterFirstLayout(main.java:90)
at advanceit.way_dev.main.access$100(main.java:16)
at advanceit.way_dev.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
 
Upvote 0

pleskina

Member
Licensed User
Longtime User
Hm, impossible, because this line:

GPS1.Initialize("GPS1")

occurs in ServiceCreate which (checked step-by-step in debugger) occurs BEFORE problematic line. Is there some possible delay in initialization?

I must mention that this did not occur with previous version (2.0) of B4a...

Again, I repeat, this is not a showstopper for otherwise great tool you made, but I suspect it could also be a cause for occasional app crashes when device wakes up from sleep. So finding the critter could be useful.

Thanks for hints and help!
 
Upvote 0

pleskina

Member
Licensed User
Longtime User
Hey Erel,

Thank you for your concern. Among the rest, I moved GPS initialization from service to main activity and it does not produce that error any more. Probably that is the right way.

Now in main activity I have

If FirstTime Then
WayService.GPS1.Initialize("GPS1")

and then start it according to user settings when status is loaded. Probably GPS initialization in service_create was delayed long enough for main activity to think it was not initialized.

However I still experience often app crashing when device is in sleep mode which I can not yet connect to loss of connection or GPS signal. I will be free to bother you more if I found possible problems.

Otherwise I am absolutely satisfied with b4a. Would have some improvement ideas but let them grow before I speak them out.

Thanks and best regards,
Davor
 
Upvote 0
Top