I have been working on a battery widget, the software compiles fine and the widget shows up in the list but when I put it on the screen all I get is a white block
the code in the service module is this
I have checked the tutorials and found no joy there.
also any help on how to get it to be a 1X1 panel would be helpful as well
thanks in advance for any help
the code in the service module is this
B4X:
#Region Service Attributes
#StartAtBoot: true
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all module
Dim RV As RemoteViews
Dim PhneEvents As PhoneEvents
End Sub
Sub Globals
Dim BatLvl As Int
Dim lblLvl As Label
Dim imgLvl As ImageView
imgLvl.Initialize("")
lblLvl.Initialize ("")
Dim pnlwidget As Panel
pnlwidget.Initialize ("")
imgLvl.Bitmap = LoadBitmap(File.DirAssets, "geekbatloadbg.gif")
End Sub
Sub Service_Create
RV = ConfigureHomeWidget("l1","RV",5,"geekBat",True)
End Sub
Sub Service_Start (StartingIntent As Intent)
If RV.HandleWidgetEvents(StartingIntent) Then Return
PhneEvents.Initialize("phneevents")
End Sub
Sub Service_Destroy
End Sub
Sub rv_RequestUpdate
'PhneEvnts_BatteryChanged
RV.UpdateWidget
End Sub
Sub rv_Disabled
StopService("")
End Sub
Sub PhneEvnts_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
Dim BatLvl As Int
Dim lblLvl As Label
Dim imgLvl As ImageView
lblLvl.Initialize ("")
BatLvl = Level
lblLvl.Text = Level
imgLvl.Initialize ("")
If Plugged = True Then
imgLvl.Bitmap = LoadBitmap(File.DirAssets,"geekbatblubg.gif")
Else
If BatLvl >50 Then
imgLvl.Bitmap = LoadBitmap(File.DirAssets,"geekbatbatlvlgrn.gif")
Else If BatLvl > 25 Then
imgLvl.Bitmap = LoadBitmap(File.DirAssets,"geekbatbatlvlylo.gif")
Else If BatLvl > 15 Then
imgLvl.Bitmap = LoadBitmap(File.DirAssets,"geekbatbatlvlorg.gif")
Else If BatLvl > 0 Then
imgLvl.Bitmap = LoadBitmap(File.DirAssets,"geekbatbatlvlred.gif")
Else
'Do Nothing
End If
End If
End Sub
I have checked the tutorials and found no joy there.
also any help on how to get it to be a 1X1 panel would be helpful as well
thanks in advance for any help