B4J Question Change Button-image programatically [SOLVED]

GMan

Well-Known Member
Licensed User
Longtime User
How can i achive this since the Button has no programmable parameters.
The Button is added through the designer

I tried this with no success:

B4X:
Sub SetGraphic(Btn As Button, Graphic As Node)
    Dim jo As JavaObject = Btn
    jo.RunMethod("setGraphic", Array(Graphic))
End Sub
B4X:
            Button1.TooltipText = "Test"
'           
            Dim iv As ImageView
            iv.Initialize("")
            iv.SetImage(fx.LoadImage(File.DirAssets, "iconau.png"))
            SetGraphic(Button1,  iv)

The image is not changing
 

TILogistic

Expert
Licensed User
Longtime User
?

and animation:
 
Upvote 0
Top