iOS Question Common Code B4A and B4i

Discussion in 'iOS Questions' started by cooperlegend, Feb 11, 2015.

  1. cooperlegend

    cooperlegend Active Member Licensed User

    Hi, I have a big project that I have developed in B4A and have recently converted to B4i also

    I now wish to share as much of the code code between the two projects using

    #If B4i and #If B4A around code that can't be shared.

    I am slowly merging each code block into a common code block but came a across a problem with sharing my HttpUtils code

    In the Android project I use a service module to make the httputil calls such as
    Code:
    Dim jobCompetitions As HttpJob
        jobCompetitions.Initialize(
    "JobCompetitions", Me)
    But in the Apple project there is no service module so this code is added to a Code Module.

    I wish to share the .bas code module but.
    Apple Project wont load if the .bas is a service module.
    Android wont compile if the .bas is a code module ("Me" not supported)

    Any ideas how to get around this anyone?

    Is it possible to #include code like in VB.Net to share the code in the Android Service module ?

    Thanks in Advance
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can move the code to a class and then reuse the class. The class will have the same context as the service in B4A (assuming that you initialize it from the service).

    There will be more options to share code in the next version (with extension modules).
     
    stevel05 likes this.
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