Bryanne Vega Member Licensed User Longtime User Nov 6, 2015 #1 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?
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?
Erel B4X founder Staff member Licensed User Longtime User Nov 6, 2015 #2 You can write the Java code in any tools you like (including notepad). You can use SLC to compile the code and build the jar + xml files. https://www.b4x.com/android/forum/threads/29918/#content Upvote 0
You can write the Java code in any tools you like (including notepad). You can use SLC to compile the code and build the jar + xml files. https://www.b4x.com/android/forum/threads/29918/#content
Informatix Expert Licensed User Longtime User Nov 6, 2015 #3 Bryanne Vega said: 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? Click to expand... 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
Bryanne Vega said: 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? Click to expand... 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.