B4i Library [Tool] Bal2Bil - B4A Layouts Converter

Don't use this tool. More powerful and simpler feature is available inside the IDE: https://www.b4x.com/android/forum/threads/b4x-sharing-layouts-between-platforms.109296/#content

This is a small command line tool that converts B4A layout files (bal files) to B4i layout files.

It is written in B4J. The source code is attached.

The purpose of this tool is to help you with the conversion. Not all views and properties will be converted as there are views such as TabHost that are not available in B4i (and iOS).

Using this tool is simple. It expects two parameters: the input file (bal) and the output file (bil).
java -jar Bal2Bil.jar <input.bal> <output.bal>

SS-2017-01-01_14.20.14.png


Bal2Bil.zip - source code
Bal2Bil.jar - executable jar (not a library).
 

Attachments

  • Bal2Bil.jar
    185.7 KB · Views: 322
  • Bal2Bil.zip
    5.8 KB · Views: 247
Last edited:

JonPM

Well-Known Member
Licensed User
Longtime User
Awesome tool. One thing I noticed is text color for buttons did not transfer to bil
 

fox96

Member
Licensed User
Longtime User
Hello Erel, changed the code to pass only the file .bal to create the .bil. So you can drag the file .bal without using the prompt.

B4X:
Log($"Bal2Bil version ${version}"$)
    bc.Initialize
'    If Args.Length <> 2 Then
'        Log("Usage: Bal2Bil <input file> <output file>")
'        ExitApplication2(1)
'    End If
    If Args.Length =0 Then
        Log("Usage: Bal2Bil <input file> <output file>")
        Log("Usage: Bal2Bil <input file>")
        ExitApplication2(1)
    End If

    Dim design As Map = bc.ConvertBalToJsonInMemory(Args(0), "")
    If design.IsInitialized = False Then
        Log("Error reading file.")
        ExitApplication2(1)
    End If
    LayoutHeader(design.Get("LayoutHeader"))
    HandleView(design.Get("Data"))
    Dim s As String
    If Args.Length=1 Then
        s=Args(0).SubString2(0,Args(0).Length-4) & ".bil"
        Else
        s=Args(1)
    End If
    bc.ConvertJsonToBalInMemory(design,s, "")
    Log("Completed successfully: " & s)
 

tufanv

Expert
Licensed User
Longtime User
Dear Erel,

Latest version is not passing the Background color of labels. Fyi.
 

ykucuk

Well-Known Member
Licensed User
Longtime User
Please test it with the attached jar.

You need to run it with:
B4X:
java -jar Bal2Bil.jar <input> <output>
Hello Erel,

B4i version is 3.60
B4A version is 6.80

I converted with last Bal2Bil.jar with successful. Unfortunately when i try open converted bil file with B4i designer i get error "system out of memory..." (i added to attachments)

Note:There is no any custom view in BAL file

Any help ?
 

Attachments

  • Screen Shot 2017-03-19 at 09.11.44.png
    Screen Shot 2017-03-19 at 09.11.44.png
    19 KB · Views: 16

ykucuk

Well-Known Member
Licensed User
Longtime User
Hello erel,

Versiyon is 1.10. i added files to attachment.

Thank you for support
 

Attachments

  • B4X.zip
    166.5 KB · Views: 25
Last edited:

Roycefer

Well-Known Member
Licensed User
Longtime User
Erel,
What is your distribution policy on this tool? Is it permissible to include code from this in a for-profit app?
 

Maicon

Member
Licensed User
Longtime User
I have large applications that exceed more than 50 layouts, so copying and pasting in b4i is sometimes unfeasible
 
Top