Java Question Wrap library as view instead of ActivityObject

Hello, I managed to wrap a library but the only way i can currently use it is through the designer. Is there a way to wrap a library and display the UI with Activity.AddView(WrappedLibraryObject, left, top, width, height)

i Followed this tutorial to wrap the library: https://www.b4x.com/android/forum/threads/wrapping-kotlin-code-and-libraries-for-b4a.91462/

Is there another tutorial that i can use for what i want, or im just stuck with using the designer?

Thanks for your time!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

abilio486software

Active Member
Licensed User
Dear Erel,
Sorry to disagree but I’ve been read that you are always against building the interface programmatically.
Projects with an high level of adaptative interfaces, have benefits using the interface programmatically.
From a perspective of transparency, It would be better to accept that are some developers or projects that prefer the designer and others that don’t.
In same perspective, all custom controls should be able to be used or in the designer or directly through Addview directive, which is not happening with B4A.
Even respect your work, the designer is not propyl at the level of a Visual Basic designer and even with a WYSIWYG designer, Microsoft let us to add all controls on both ways.
BR
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Your comments doesn't help in any way.

I gave the full answer and also directed the user to examples that show how to develop views that can be added programmtically.
the designer is not propyl at the level of a Visual Basic designer
Many years have passed since I've used VB6 but if I remember correctly it didn't support features such as anchors, designer script and variants. It is of course simpler to make a built-in WYSIWYG designer when the IDE is running on the target platform (Windows).
 
1. ActivityObject is not relevant to this question.
2. You are not stuck with the designer. Over time you will learn that it is much simpler to develop with B4X using the designer.
3. You don't need to do anything special to create a view programmatically.
Many examples here: https://github.com/AnywhereSoftware/B4A/tree/master/B4AObjects/src/anywheresoftware/b4a/objects
My bad about the ActivityObject, thought it was something specific for the designer. Anyway I managed to wrap the library so I can add the view programmatically by implementing the build and initialize methods used in the examples you gave me. I also listened to your advice about the designer and honestly it's way easier and cleaner that making the design programmatically.
 
Top