Hello guys i want to update my widget text every 1 minutes but instead of it they update nothing where is my error here is the code:
'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 rv As RemoteViews
Dim ST As SQL
Dim Cursor As Cursor
End Sub
Sub Service_Create
'Set the widget to update every 1 minutes.
rv = ConfigureHomeWidget("WidgetLayout", "rv", 1, "Widget")
If File.Exists(File.DirInternal,"database.db") Then
ST.Initialize(File.DirInternal, "database.db", False)
rv.UpdateWidget
End If
End Sub
Sub Service_Start (StartingIntent As Intent)
If rv.HandleWidgetEvents(StartingIntent) Then Return
End Sub
Sub Service_Destroy
End Sub
Sub rv_RequestUpdate
SetTexting
rv.UpdateWidget
End Sub
Sub rv_Disabled
StopService("")
End Sub
Sub SetTexting
If File.Exists(File.DirInternal,"database.db") Then
rv.SetText("Label1", "Here is the result: " & ST.ExecQuerySingleResult("SELECT count(*) FROM database"))
Else
rv.SetVisible("Label2", True)
End If
rv.UpdateWidget
End Sub
'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 rv As RemoteViews
Dim ST As SQL
Dim Cursor As Cursor
End Sub
Sub Service_Create
'Set the widget to update every 1 minutes.
rv = ConfigureHomeWidget("WidgetLayout", "rv", 1, "Widget")
If File.Exists(File.DirInternal,"database.db") Then
ST.Initialize(File.DirInternal, "database.db", False)
rv.UpdateWidget
End If
End Sub
Sub Service_Start (StartingIntent As Intent)
If rv.HandleWidgetEvents(StartingIntent) Then Return
End Sub
Sub Service_Destroy
End Sub
Sub rv_RequestUpdate
SetTexting
rv.UpdateWidget
End Sub
Sub rv_Disabled
StopService("")
End Sub
Sub SetTexting
If File.Exists(File.DirInternal,"database.db") Then
rv.SetText("Label1", "Here is the result: " & ST.ExecQuerySingleResult("SELECT count(*) FROM database"))
Else
rv.SetVisible("Label2", True)
End If
rv.UpdateWidget
End Sub