Android Question how to initialize XUI views

saeed10051

Active Member
Licensed User
Longtime User
I am trying to load Swiftbutton at run time similar to a normal button. There i am required to initialize my swiftbutton but there are two parameters that need to be specified when initializing swiftbutton i.e. callback as object and event name as string. Is there a working example of loading xui controls at runtime.
 

saeed10051

Active Member
Licensed User
Longtime User
Thanks LucaMs, i have used the example code over there which was originally for switch and replaced if for Swiftbutton. It is loading, however i am unable to set the button text as there is not text property shown in the swiftbutton1 property list. I have tried swiftbutton1.mbase.text but it is giving me following error
java.lang.RuntimeException: Type does not match (class anywheresoftware.b4a.BALayout)
 
Upvote 0

saeed10051

Active Member
Licensed User
Longtime User
Issue resolved
I have used following code
B4X:
    Dim b As SwiftButton = Sender
    b.SetColors(xui.Color_Blue, xui.Color_Cyan)
 
Upvote 0
Top