Android Question object base class

Kiran Raotole

Active Member
Licensed User
Hii experts,
I have to create an application by custom components class.
in which I want all same property of default object.
like Button class, I want to create my custom components button which contains all property and event of buttons. like in other software, there is option of base class, to take all similar property to this class.

I created a new custom components custbutton
I add it in my designer trying to generate button_click event, but it not show.
 
Last edited:

Kiran Raotole

Active Member
Licensed User
I try it. I create my custom view. In designercreateview my code is :

B4X:
Public Sub DesignerCreateView (Base As Panel, Lbl As Label, Props As Map)
   mBase = Base
   Dim label As Label
   label.Initialize("label1")
   mBase.AddView(label,0,0,mBase.Width,mBase.Height)
   label.Color = Colors.Transparent
   Log(label.Text)
   'label.TextColor = Colors.Black
End Sub

in designer view I assigned property text, but It not show in my application.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

Kiran Raotole

Active Member
Licensed User
I need to get default value of my custom property.

B4X:
#DesignerProperty: Key: BackgroundColor, DisplayName: BackgroundColor,FieldType: Color, DefaultValue: #00E650
this is my property. I'm trying mBase.Color = Props.Get("BackgroundColor")

How does I get defaultvalue of property of my custom view ?
and how those I get know whether a property default value is changed
 
Upvote 0

Kiran Raotole

Active Member
Licensed User
I need to get default value of my custom property.

B4X:
#DesignerProperty: Key: BackgroundColor, DisplayName: BackgroundColor,FieldType: Color, DefaultValue: #00E650
this is my property. I'm trying mBase.Color = Props.Get("BackgroundColor")

How does I get defaultvalue of property of my custom view ?
and how those I get know whether a property default value is changed
I got this.

I have issue that, I created default property of color, then I insert object in activity, if then I change the color default property then activity color does not change.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
You should use set/get to retrieve and to set values.

Example:

Public Sub setColor(value as int)
Myview.color=value
End sub

Public Sub getColor as it
Return Myview.color
End sub

Please not the lowercasing of the words get/set

Then in your app you can

MyView=25865 (this sets the value)

Dim myColor=Myview.color as int


Remember this is pseudo-code
You should also read the booklets as they cover extensively the custom views and their properties
 
Upvote 0

Kiran Raotole

Active Member
Licensed User
Now, I create a EditText custom view .In activity I change text property.
but it not change anything.

Does there is any command for this or I have to add all my property?
 
Upvote 0
Top