B4J Tutorial B4J tutorial for Basic4android developers

Discussion in 'B4J Tutorials' started by Erel, Nov 19, 2013.

  1. Erel

    Erel Administrator Staff Member Licensed User

    B4J development tool is similar to Basic4android. The language and IDE are mostly identical.

    The APIs (methods, keywords and libraries) are identical in some cases and different in other cases.

    I converted existing frameworks such as DBUtils, HttpUtils2, DateUtils, RDC, ImageDownloader and others from B4A to B4J. It was simpler than I expected it to be. In some cases no changes were required at all.


    There are two types of modules in B4J. Code modules and classes. Classes are identical to B4A classes.
    Code modules are similar to B4A modules however they are more powerful as they can handle events.

    A code module can be considered as a class with exactly one instance (such instances are sometimes called singletons or static classes). Activities and Services are not required in B4J. You should instead use code modules. Note that when you add an existing B4A activity or service to B4J project it will be converted to a code module.

    CallSub is mostly not required in B4J as you can directly call methods of other classes or code modules.

    Generally speaking it is simpler to develop with B4J as you do not need to deal with the activities (and services) life cycle. This also means that there is no such concept as "activity object".


    The main difference is in the UI. B4J is based on JavaFX UI and Basic4android is based on the native Android UI.

    It is worth going over Oracle Scene Builder tutorials to better understand the UI. Once you understand how the UI integrates with B4J code then the other concepts such as the "event name" concept are the same.

    Colors - In Basic4android colors are represented as Ints (2 bytes for Alpha, R, G, and B). In B4J colors are represented as Paints.
    You can use fx.Colors.From32bit to convert an Int value to a Paint.

    This tutorial will be expanded in the future...
    yiankos1, JOTHA, Ferbis and 13 others like this.
  2. metheoneandonly

    metheoneandonly Member Licensed User

    Thank you Erel for making this tool free! I really appreciate this. Can't wait to try it.
  3. swissmade

    swissmade Active Member Licensed User

    This is exactly where I have waiting for.
    Many thanks Erel.

    Question is this only for B4A users??
  4. Erel

    Erel Administrator Staff Member Licensed User

  5. arman

    arman New Member Licensed User

    I must say, this is a huge leap for all of us. Thank you to make it free for us.
  6. Malky

    Malky Active Member Licensed User

    Cheers Erel, can't wait to try it!

  7. desof

    desof Well-Known Member Licensed User

    Congratulations from Argentina!!

    Where do I can see examples to start?
  8. mjtaryan

    mjtaryan Active Member Licensed User

    Thanks, Erel. This will be most helpful.

    A curious question: Is your ultimate goal to create a full crosss-platform development system that also includes iOS and Blackberry?
  9. Paolo Cosentino

    Paolo Cosentino Member Licensed User

    Excellent job Erel, B4J is really easy to use. I like it.
    vjsoft57 likes this.
  10. gulliver

    gulliver Member Licensed User

    A new challenge.
    Thanks Erel.
  11. Eduard

    Eduard Active Member Licensed User

    Thanx, I'll try it.
  12. Woofs

    Woofs New Member Licensed User

    Thank you for your excellent development tool. Keep the tutorials coming please.
  13. reikhard

    reikhard Member Licensed User

    Thank You Erel for create another "tool" to develop... thanks also to everyone that is creating libraries and helping others in this forum :)
  14. blong

    blong Active Member Licensed User

    Thank you ... very worthwhile and great effort.
  15. Ratna Fang

    Ratna Fang Member Licensed User

    does it mean i can create simple app for linux, mac, and win, using the same language (or at least similiar) with b4a?

    erel is the st. clauss of this year :) :D
  16. Erel

    Erel Administrator Staff Member Licensed User

    Yes. Both simple and complex apps...
  17. kosay

    kosay Member Licensed User

    but where is designer ?
  18. swissmade

    swissmade Active Member Licensed User

  19. Doug Johnson

    Doug Johnson Member Licensed User

    I am getting "Rapid Debugger failed to connect to device" when I compile and run. I began a new project and added a Button just to see how things look and run but can't seem to get to square one.


  20. giga

    giga Well-Known Member Licensed User

    Make sure you are connected to your device in (B4A) under Tools/B4A Bridge and select wireless or Bluetooth toy your device.

    BTW. This is posted in the wrong spot B4J does not have rapid debugger.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice