Android Question Debugger gives error on empty and commented lines

Roger C

Active Member
Licensed User
Longtime User
Hi all,
I'm getting crazy about this.
I have B4A v8.80 and a Samsung Galaxy 7 connected via Bridge and network.
When I'm running the app in Debug-mode I get errors in the Log like the ones below and the app won't start.

The thing is that line 78 and 88 in Main is commented out with '
If I delete the lines it still says error on these lines.

I've even moved all code to another module, it still says Main has the error, until I close B4A and then open it again. Now the error is in the new module.

This is part of the code where the errors appear: (it's very messy since I've been trying different things)
B4X:
Sub LoadEvents                             'Row 70
    
    'lstvEvents.Initialize("lstvEvents")
'    mycalendarlist.Initialize
'    cal.Initialize
    
    Dim lMessage As String
    
'''    If Starter.CalendarID <> Null Then            'Row78
        
        Log("LoadEvents  ID:" & Starter.CalendarID)
        Log("LoadEvents  Name:" & Starter.Calendarname)
        lblCalendarName.Text = Starter.CalendarName
                
        'Läs in events
        'lstvEvents.Initialize                            'Row 88
        lstvEvents.Clear
        'mycalendarlist.Initialize
        'cal.Initialize
        mycalendarlist.Clear
                
        mycalendarlist = cal.GetListofEventsforCalendarBetweenDates(Starter.CalendarID,DateTime.Add(DateTime.Now,0,0,-7),DateTime.Add(DateTime.Now,0,0,0))
        
        'Each event is made up of the following 7 elements and the list repeats in blocks of 7 for every events
        '(0) Event Name
        '(1) Description
        '(2) Start Time
        '(3) End Time
        '(4) Location
        '(5) All day indicator, 1= all day, 0= not
        '(6) Event_ID


And here are from the Log: (more text below)

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Error occurred on line: 78 (Main)
java.lang.NumberFormatException: empty String
    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1842)
    at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
    at java.lang.Double.parseDouble(Double.java:539)
    at b4a.example.main._loadevents(main.java:460)
    at b4a.example.main._activity_resume(main.java:440)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
    at b4a.example.main.afterFirstLayout(main.java:110)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6944)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
LoadEvents  ID:
LoadEvents  Name:
Error occurred on line: 88 (Main)
java.lang.NumberFormatException: empty String
*** Service (starter) Create ***


If I use line 78 and change it to:
B4X:
If Starter.CalendarID = 20 Then
Then I can run the app but there is still the same errors in the debugger

What is going on?
 

KMatle

Expert
Licensed User
Longtime User
Check if "lMessage" isn't alreday defined as a map, module or anything else. I had something similar when I used a map which was defined as a list. Took me some time. Error was then "xxx is not numeric" or so. Check too, if all the calendar objects are initialized and have the correct type.
 
Upvote 0

Roger C

Active Member
Licensed User
Longtime User
Check if "lMessage" isn't alreday defined as a map, module or anything else. I had something similar when I used a map which was defined as a list. Took me some time. Error was then "xxx is not numeric" or so. Check too, if all the calendar objects are initialized and have the correct type.

Thanks but that was not the problem. :)
The real issue is that I get warnings on comments.

If I remove the comment from line 78 and change it to...

If Starter.CalendarID = 20 Then

...everything works?? And yes I did comment out "End If" too. :)
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Probably best if you upload the entire project.

- Colin.
 
Upvote 0
Top