Android Question Custom View Default Value

Kiran Raotole

Active Member
Licensed User
I create custom class, I assign some property and its default value to it, then I add custom view in activity and, then I change default value of property in custom view. But its update default value in my activity.

What is solution for this?
 

LucaMs

Expert
Licensed User
B4X:
#DesignerProperty: Key: MyProperty, DisplayName: My property, FieldType: Int, DefaultValue: 10, MinRange: 0, MaxRange: 100, Description: Note that MinRange and MaxRange are optional.

B4X:
Sub Class_Globals
    Private mMyProperty As Int
    ' ...
End Sub

B4X:
Public Sub DesignerCreateView (Base As Panel, Lbl As Label, Props As Map)
    mMyProperty = Props.Get("MyProperty")
    ' ...
End Sub

B4X:
Public Sub setMyProperty(Value As Int)
   mMyProperty = Value
End Sub
Public Sub getMyProperty As Int
   Return mMyProperty
End Sub
 
Upvote 0
Top