Java Question Include a layout file into a library

Phayao

Active Member
Licensed User
Longtime User
Hello everybody,

maybe my question is very trivial, but after some days of experimenting I still cannot figure this out:
I want to create a lib by "compile as library" from a class.
B4X:
Sub Class_Globals
    Private mEventName As String 'ignore
    Private mCallBack As Object 'ignore
    Public mBase As B4XView
    Private xui As XUI 'ignore

    Private lblText As Label
    Private datamap As Map
End Sub

Public Sub Initialize (Callback As Object, EventName As String)
    mEventName = EventName
    mCallBack = Callback
End Sub

Public Sub DesignerCreateView (Base As Object, lbl As Label, Props As Map)
    mBase = Base
    Sleep(0) 'cannot load layouts in DesignerCreateView without calling Sleep before
    mBase.LoadLayout("overviewnt.bal")    ' <=== critical step !!
....

The code using this as class works fine.
After compilation as library and calling it from a program, i get the error "cannot find 'overviewnt.bal' "
In the generated jar file, the sub DesignerCreateView appears as class.
To my understanding, the layout file should be included in the jar file.
Another app using the same principle, there it works ...
What can be wrong here ?

Thanks for you appreciated help !
Chris
 

Phayao

Active Member
Licensed User
Longtime User
Thank you Erel,
I thought about this, but then I have to tell the user of the lib to include 2 other libraries. Compiling as a library will load them automatically.
One mistake of mine could be that i call mBase.removeviews - i replaced it with mBase.visible = wrong.
My next problem is, that i need 2 layouts, that can be chosen by the user. That's the next challenge ;-)
Chris
 
Top