Android Question Android Libraries

Bryanne Vega

Member
Licensed User
Longtime User
Can a library be created in Android Studio (that has any SDK it needs) and then be used in B4A?


Instead of porting the whole SDK I can just port a library with what I need?
 

Informatix

Expert
Licensed User
Longtime User
Can a library be created in Android Studio (that has any SDK it needs) and then be used in B4A?


Instead of porting the whole SDK I can just port a library with what I need?
Depending on the library, you may have to write a Java wrapper. The main purpose of this wrapper is to convert all Java types to types supported by B4A (e.g. ArrayList -> List, HashMap -> Map, etc.) and to adapt the code to the B4A way of doing things (e.g. we do not use XML files in B4A for the views). This wrapper can expose to B4A only the fields and methods that you need. In some cases, usually when the library is not visual (no views), the wrapper is not necessary. With JavaObject, you can access the fields and methods by reflection. There's a tutorial about this.
 
Upvote 0
Top