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

B4JExplorer

Active Member
Licensed User
Longtime 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,

B4X:
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.
 

Daestrum

Expert
Licensed User
Longtime User
You have to set the JavaObject to Me
ie
dim jo as JavaObject = Me
then use jo.runmethod("whatever",null) etc
 
Upvote 0
Top