Android Question program stopped- java.lang.NullPointerException

jchal

Active Member
Licensed User
Longtime User
one question , why do i get this error ?
i run a step by step debugger everything looks ok
the program is stoped and it desplays in logs the error message below why?


i amended the code to
B4X:
Sub JobDone (Job As HttpJob)
    ProgressDialogHide
    If Job.Success = True Then
        Dim strReturn As String = Job.GetString  
        Dim parser As JSONParser
        parser.Initialize(strReturn)
        If Job.JobName = "kdraw" Then
          
            Dim root As Map = parser.NextObject
            Dim draw As Map = root.Get("draw")
            Dim drawTime As String = draw.Get("drawTime")
            Dim drawNo As Int = draw.Get("drawNo")
            Dim results As List = draw.Get("results")
            'For Each colresults As Int In results
                Dim mytime,mydate As String          
                Label1.Text= "Draw" & draw
                mytime= sf.Right(drawTime,8)
                mydate=sf.Left(drawTime,10)
                Label2.Text="Draw Time" &  mytime & "Draw Date" & mydate
                Label3.Text="Draw Number" & drawNo
                Label4.Text=" Results" & results
              
                'For i = 0 To results.Size - 1
                Dim number0,number1,number2,number3,number4,number5,number6,number7,number8,number9,number10,number11,number12,number13,number14,number15,number16,number17,number18,number19 As Int
              
              
                number0 = results.Get(0)
                number1 = results.Get(1)
                number2 = results.Get(2)
                number3 = results.Get(3)
                number4 = results.Get(4)
                number5 = results.Get(5)
                number6 = results.Get(6)
                number7 = results.Get(7)
                number8 = results.Get(8)
                number9 = results.Get(9)
                number10 = results.Get(10)
                number11 = results.Get(11)
                number12 = results.Get(12)
                number13 = results.Get(13)
                number14 = results.Get(14)
                number15 = results.Get(15)
                number16 = results.Get(16)
                number17 = results.Get(17)
                number18 = results.Get(18)
                number19 = results.Get(19)          
      
        Else
            ToastMessageShow("Error: Invalid Value", True)
        End If
    Else
        'Log("Error: " & Job.ErrorMessage)
        ToastMessageShow("Error: " & Job.ErrorMessage, True)
    End If
    Job.Release
End Sub
 

jchal

Active Member
Licensed User
Longtime User
when thease lines are commented it works
B4X:
 Dim mytime,mydate As String        
                Label1.Text= "Draw" & draw
                mytime= sf.Right(drawTime,8)
                mydate=sf.Left(drawTime,10)
                Label2.Text="Draw Time" &  mytime & "Draw Date" & mydate
i still canot understand why using degugger the values are passing to the parameters
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
when thease lines are commented it works
this is not using any webview (android webkit). I i expect this is NOT the problem.
What is sf?
Does sf use a webview in any kind?

mytime= sf.Right(drawTime,8)
mydate=sf.Left(drawTime,
10)
i would replace it with B4A methods to do the same. No need for a library.
 
Upvote 0

jchal

Active Member
Licensed User
Longtime User
can you please send me a link for b4a methods?
this is what is sf

B4X:
Sub Globals
Dim sf As StringFunctions
    sf.Initialize
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…