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:

Cableguy

Expert
Licensed User
Longtime User
without seeing your code, we can only guess…
 
Upvote 0

Kiran Raotole

Active Member
Licensed User
Sorry, Here is my edittext custom view :
B4X:
Public Sub DesignerCreateView (Base As Panel, Lbl As Label, Props As Map)
    mBase = Base
    edittext.Initialize("edittext")
    Base.AddView(edittext,0,0,Base.Width,Base.Height)
End Sub

and In activity i'm using edittext property like hinttext, but it not work.
Is there is any option for this?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I think that a good way when you "wrap" a "native View", to add custom properties/events which the View does not has, is to write only the new feateures and expose the "native View" (by a method) to allow the developer to set all the other properties, instead of creating in the custom view all the properties already present in the View.

For example: i want a jumping button. Well, I create my custom view, a Button1 inside of it, the jumping method (Public Sub Jump(...)) and a method to get the "base button" (Public GetButton As Button - Return Button1)
 
Last edited:
Upvote 0

Kiran Raotole

Active Member
Licensed User
I tried like this but I'm unable to change default property then or use event, like if I want to use that custom view click event, i can't use it.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I haven't done much work with B4A in a long time, but on b4j it will throw at least an error, even if it doesn't crash the app completely
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I haven't done much work with B4A in a long time, but on b4j it will throw at least an error, even if it doesn't crash the app completely
I suppose you wanted to answer the other discussion-thread.

It is not so; your app does not crashes if the activity sub you try to call from inside your (custom view) class does not exists.
Anyway, if you use SubExists you do not create damage :D
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I suppose you wanted to answer the other discussion-thread.

It is not so; your app does not crashes if the activity sub you try to call from inside your (custom view) class does not exists.
Anyway, if you use SubExists you do not create damage :D
That's the danger of using the phone to answer topics... sorry for posting on the wrong thread.
Thanks Lucas for pointing this out
 
Upvote 0
Top