B4J Question What class name should be used in JavaObject, for inline?

Discussion in 'B4J Questions' started by B4JExplorer, Feb 24, 2015.

  1. B4JExplorer

    B4JExplorer Active Member Licensed User

    Hi,

    If we're just testing some functionality in a non-ui app, no events, how do we initialize the JavaObject? The method is inside the B4J code, so I'm not clear on what the Class Name should be.


    A simple example,

    Code:
    Dim sResult As String = ""

    #If JAVA
    public static String WhoDat() {
       return "Who Dat?";
    }
    #End If


    '/*
    ' What goes here?  Which inititialize method from the JavaObject library should be used, and what is the class name?
    '*/

    ' jo_WhatThe.InitializeStatic( "WHAT CLASS NAME GOES HERE?" )

    sResult = jo_WhatThe.RunMethod( 
    "WhoDat"Null )
    Or if the method is not static, then what should be the classname in the InitializeNewInstance method?

    Sorry if this should be obvious, but every example out there, seems to be assuming a graphic interface and events, and depends on Activity_Create.
     
  2. Daestrum

    Daestrum Well-Known Member Licensed User

    You have to set the JavaObject to Me
    ie
    dim jo as JavaObject = Me
    then use jo.runmethod("whatever",null) etc
     
  3. B4JExplorer

    B4JExplorer Active Member Licensed User

    Ah, ok. I thought that Me referred only to the current form, and wasn't relevant to a non-ui app.

    Got it, thanks Daestrum.
     
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