Hi,
I have a widget with a single image view. I'm trying to load a bitmap into the image view based on a true or false value loaded from KVS. The loading from KVS is working based on the toast messages but the bitmap is not loading into the image view.
Can you check my coding and let me know what coding I'm missing?
Thanks.
I have a widget with a single image view. I'm trying to load a bitmap into the image view based on a true or false value loaded from KVS. The loading from KVS is working based on the toast messages but the bitmap is not loading into the image view.
Can you check my coding and let me know what coding I'm missing?
Thanks.
B4X:
#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
' objects.
'---------
Private rv As RemoteViews
Private kvs As KeyValueStore
End Sub
Sub Service_Create
rv = ConfigureHomeWidget("theWidget", "rv", 0, "RLEIMAN")
End Sub
Sub Service_Start (StartingIntent As Intent)
' Initialize objects.
'--------------------
kvs.Initialize(File.DirDefaultExternal, "Settings")
' Handle events.
'---------------
If rv.HandleWidgetEvents(StartingIntent) Then
If kvs.Get("TESTING") Then
rv.SetImage("ImageViewSound", LoadBitmap(File.DirAssets, "WhiteSpeaker.png"))
ToastMessageShow("WhiteSpeaker", True)
Else
rv.SetImage("ImageViewSound", LoadBitmap(File.DirAssets, "BlueSpeaker.png"))
ToastMessageShow("BlueSpeaker", True)
End If
Return
End If
End Sub
Sub Service_Destroy
End Sub
Sub rv_RequestUpdate
rv.UpdateWidget
End Sub
Sub rv_Disabled
StopService("")
End Sub
' Misc sub routines.
'-------------------