Android Question How to re-draw button in service

Shay

Well-Known Member
Licensed User
Longtime User
I am using RSStandout to create on off button for my app
it uses service, and I cannot declare button on Proccess_Globals

so after I create my "on" button:
B4X:
btnMic.SetBackgroundImage(LoadBitmap(File.DirAssets,"on.png"))

I have click event, and I wish my button will change to "off":
B4X:
btnMic.SetBackgroundImage(LoadBitmap(File.DirAssets,"off.png"))

how can I do it?
 

Shay

Well-Known Member
Licensed User
Longtime User
solve this like this:
B4X:
Sub btnMic_Click
   
    Dim a As Button
   
    If ServiceGPS.AppOn = True Then
    a=StandOut.RequestViewByTag("btnMic")
    a.SetBackgroundImage(LoadBitmap(File.DirAssets,"off.png"))
    ServiceGPS.AppOn = False
    Else
    a=StandOut.RequestViewByTag("btnMic")
    a.SetBackgroundImage(LoadBitmap(File.DirAssets,"on.png"))
    ServiceGPS.AppOn=True
    End If
   
End Sub
 
Upvote 0
Top