Hiya all,
Last night I decided to convert one of my Widgets projects from using HttpUtils to using Http2Utils. The following basic code works perfect in an 'Activity module', but in a ''Service module' I just keep getting the following error.
** Service (stardatewidget) Create **
** Service (stardatewidget) Start **
httpjob_download (java line: 77)
java.lang.NullPointerException
It appears to fall over on the following line which works in an 'Activity module'.
GetWeatherDataXML.Download("http://weather.yahooapis.com/forecastrss?w=2442047&u=c")
I've cut all the code out and just left the following code, I'm still getting the same error.
'Service module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim GetWeatherDataXML As HttpJob
Dim WeatherDataXML As String
Dim RV As RemoteViews
End Sub
Sub Service_Create
RV = ConfigureHomeWidget("testlayout", "RV", 30, "Test Weather Data", True)
End Sub
Sub Service_Start(StartingIntent As Intent)
GetWeatherDataXML.Initialize("GetWeatherDataXML", Me)
GetWeatherDataXML.Download("http://weather.yahooapis.com/forecastrss?w=2442047&u=c")
End Sub
Sub Service_Destroy
StopService("")
CancelScheduledService("")
End Sub
Sub JobDone(Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Select Job.JobName
Case "GetWeatherDataXML"
WeatherDataXML = Job.GetString
Log(Job.GetString)
End Select
Else
ToastMessageShow("Oops: " & Job.ErrorMessage, True)
Log("Oops: " & Job.ErrorMessage)
End If
Job.Release
End Sub
Any help would be seriously appreciated as the above code works perfect in an 'Activity module' but falls over in an 'Service module'.
Thank you
Pete...
Last night I decided to convert one of my Widgets projects from using HttpUtils to using Http2Utils. The following basic code works perfect in an 'Activity module', but in a ''Service module' I just keep getting the following error.
** Service (stardatewidget) Create **
** Service (stardatewidget) Start **
httpjob_download (java line: 77)
java.lang.NullPointerException
It appears to fall over on the following line which works in an 'Activity module'.
GetWeatherDataXML.Download("http://weather.yahooapis.com/forecastrss?w=2442047&u=c")
I've cut all the code out and just left the following code, I'm still getting the same error.
'Service module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim GetWeatherDataXML As HttpJob
Dim WeatherDataXML As String
Dim RV As RemoteViews
End Sub
Sub Service_Create
RV = ConfigureHomeWidget("testlayout", "RV", 30, "Test Weather Data", True)
End Sub
Sub Service_Start(StartingIntent As Intent)
GetWeatherDataXML.Initialize("GetWeatherDataXML", Me)
GetWeatherDataXML.Download("http://weather.yahooapis.com/forecastrss?w=2442047&u=c")
End Sub
Sub Service_Destroy
StopService("")
CancelScheduledService("")
End Sub
Sub JobDone(Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Select Job.JobName
Case "GetWeatherDataXML"
WeatherDataXML = Job.GetString
Log(Job.GetString)
End Select
Else
ToastMessageShow("Oops: " & Job.ErrorMessage, True)
Log("Oops: " & Job.ErrorMessage)
End If
Job.Release
End Sub
Any help would be seriously appreciated as the above code works perfect in an 'Activity module' but falls over in an 'Service module'.
Thank you
Pete...