Android Question Passing B4A Activity to Inline Java code

Discussion in 'Android Questions' started by Johan Schoeman, Dec 2, 2017.

  1. Johan Schoeman

    Johan Schoeman Expert Licensed User

    I am using an inline Java code method that expects an Activity to be passed to it. How do I pass the "active" B4A activity to the Java method? Have tried passing "Me" and "Activity" but none seems to work. Always getting a signature mismatch error.

    Can someone please advise?

    Need to do a call using the JavaObject library such as for eg:
    nativeMe.RunMethod("blabla", array(the_b4a_activity"))

    (please ignore any typos in the above call - posting this from a laptop that is not the one that I use for B4A. Just need to understand how to pass the B4A activity)
     
  2. JordiCP

    JordiCP Well-Known Member Licensed User

    This works :)
    Code:
    Dim J as JavaObject
    J.initializeContext
    J.RunMethod(
    "mySub",Array(J,myOtherParams))
     
  3. Johan Schoeman

    Johan Schoeman Expert Licensed User

    You are so sharp.....! Thanks @JordiCP
     
    JordiCP likes this.
  4. Johan Schoeman

    Johan Schoeman Expert Licensed User

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