Android Question I've a study Widged but, the Click not work.

CyclopDroid

Well-Known Member
Licensed User
Longtime User
Hi dear,
I wont study the widget programming but, when I insert a Sub Click, from my object, into Service Module, not working and not stopped if I insert a Break Point.

My simple App, is create a duble bottom qhen one immage (bitmap) declare.
When I Click into her, control if the value Int declared is o or 1 and viualize a image... but the Click not work!


B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
   
        Dim OnOff As Int
        Dim rv As RemoteViews
        Dim premi As Bitmap
End Sub
Sub Service_Create
    rv = ConfigureHomeWidget("Widget", "rv", 0, "Bottoni",True)
    Tasto.Initialize(File.DirAssets, "OnlyOn.png")  
    OnOff=0
End Sub

Sub Service_Start (StartingIntent As Intent)  
  
End Sub

Sub Service_Destroy

End Sub

Sub Button1_Click
    If OnOff=0 Then
        premi.Initialize(File.DirAssets, "On.png")
        OnOff=1      
    Else
        premi.Initialize(File.DirAssets, "Off.png")
        OnOff=0
End If

End Sub

My Design have one Panel (Panel1) and, into this, one button (Button1) and one ImageView (Premi).

Why the Click (Sub Button1_Click) not work?

PS: Not have other one command. I've create My Activity and I've only this command:


B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.Finish
End Sub

Thanks you.
 

CyclopDroid

Well-Known Member
Licensed User
Longtime User
Thank you for your interest, but I solved it.
LucaMS have help me fo resolve it.
The problem is the code
B4X:
Tasto.Initialize(File.DirAssets, "OnlyOn.png")

Changed with:

B4X:
rv.SetImage("Tasto", LoadBitmap(File.DirAssets, "OnlyOn.png"))

Tasto is a Bitmap.

Thanls you.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…