Android Question Same code base, multi platform

Discussion in 'Android Questions' started by mmanso, Jan 29, 2015.

  1. mmanso

    mmanso Member Licensed User

    Hi there,

    Id like to write an app to run on linux and android.

    Can this be done using the same codebase and b4a and b4j?

    I beliave the ui part is diferent. Is there any technique in this technologies to deal with these issues?

    Cheers.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can use the shared modules feature to share code between different platforms.

    You can also use conditional compilation (#IF B4A / B4J / B4I).
     
  3. mmanso

    mmanso Member Licensed User

    Hi there,

    Thanks. But, in your oppinion, the UI part of it needs to be different for both platforms, right? Imagine I've an app with 100 screens. I'll have to define them twice, correct?
     
  4. sorex

    sorex Expert Licensed User

    It depends on how you structure your app and if you generate everything by code or with the designer.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Yes. JavaFX UI is different than Android UI.
     
  6. mmanso

    mmanso Member Licensed User

    It would be perfect if there was a way to write an app once and have it running on multiple platforms. You kinda do that, but on the UI side of if, has I understood, it's not "generic".

    If the UI is generated by code (not using the desinger) the API will be the same for everything, or Android has a different API than JavaFX? I mean, in the B4? API...
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    The UI API is also different.

    A desktop app looks and behaves differently than a mobile app.
     
  8. mmanso

    mmanso Member Licensed User

    I "almost" agree with you :)

    In the industry I work for (Hospitality) the hardware manufactures are creating Android machines (POS) that are exactly the same as a i386 machine. The only difference is the board inside the machine.

    So, in terms of development, that's not a "mobile app". It's a regular app, on a regular machine but running on Android.

    In this "concept", the app is the same in Android or in Windows or Linux.

    This is the problem I'm trying to tackle here.
     
  9. sorex

    sorex Expert Licensed User

    you can make them look simular the question is if they use 1 project for all 3 of them? doubt it.
     
  10. mmanso

    mmanso Member Licensed User

    They don't, because I don't know any technology that allows that.

    Actually, what I know that handles this in that way is something called kivy. It's a python project.

    After evaluating B4A, I love it's IDE and the way we code. That's why I was trying to figure out if the project we're starting could (or not) use this.
     
  11. sorex

    sorex Expert Licensed User

    you can move most of the code to modules that you can share between the 2 projects and work with conditional compilation as Erel suggested.

    if a lot is different the source might grow a lot compared to seperating everything but it's easier to maintain both when applying small fixes that are easily forgotten untill you update the other one again.

    Didn't use it myself yet but I intend to do since I focus on both systems from now on.
     
Loading...
  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