Android Question Call a sub in a class defined in starter service.

Discussion in 'Android Questions' started by davemorris, Aug 9, 2019.

Tags:
  1. davemorris

    davemorris Member Licensed User

    Hi Guys

    Up to this point in B4A, I have always used the classic CallSubDelayed()/CallSub() as appropriate to call subs in Activities or Services. However, by mistake I called a sub (defined within a class) in the Starter service using the classic OOPs format Starter.objectName.subName - and it appeared to work. Any comments.

    Assume I create a class
    Code:
    XXXclass
       :
    public sub XXXsub
      
    ' Does some work
    end sub
    Then create an object in the starter service based on this class
    Code:
    Starter Service

    public XXXobj as XXXclass
    Then in my case I called the sub from the main activity (and it appeared to work in debug)
    Code:
    Main Activity
     
    ' Some code
    Starter.XXXobj.XXXsub
    Thanks in advance, its all for my on-going attempts make my code more X-platform (B4A/B4I) friendly.

    Kind regards
    Dave
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Your code is correct.
     
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