Sub Class_Globals
' Private fx As JFX
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
Dim jo As JavaObject = Me
'Note#1: The class string for InitializeNewInstance is composed of
'1) Package name: in this test case b4j.example
'2) The name of the class module in B4A in lowercase. In this case the class module
' name is Test, but since B4A lowercases module names it becomes: test
'3) The name of the class defined in the #if JAVA section (case sensitive): TestThis
'Note#2: You could have a constructor declared. The call here would call one with
' no parameters
jo.InitializeNewInstance("b4j.example.test.TestThis", Array(Null))
Log(jo.RunMethod("ReturnString", Array("Hello from class in class")))
End Sub
#if JAVA
public class TestThis{
// It is not necessary to declare a constructor, but one could. If you have
// parameters you would need to change the Array(Null) section of the above
// call to InitializeNewInstance method.
// public TestThis() {}
public String ReturnString( String Value )
{
return Value;
}
}
#end if