Class JavaClassWrapper
- Namespace
- Godot
- Assembly
- GodotSharp.dll
The JavaClassWrapper singleton provides a way for the Godot application to send and receive data through the Java Native Interface (JNI).
Note: This singleton is only available in Android builds.
var LocalDateTime = JavaClassWrapper.wrap("java.time.LocalDateTime")
var DateTimeFormatter = JavaClassWrapper.wrap("java.time.format.DateTimeFormatter")
var datetime = LocalDateTime.now()
var formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss")
print(datetime.format(formatter))
Warning: When calling Java methods, be sure to check GetException() to check if the method threw an exception.
public static class JavaClassWrapper
- Inheritance
-
JavaClassWrapper
- Inherited Members
Properties
Singleton
public static JavaClassWrapperInstance Singleton { get; }
Property Value
Methods
GetException()
Returns the Java exception from the last call into a Java class. If there was no exception, it will return null.
Note: This method only works on Android. On every other platform, this method will always return null.
public static JavaObject GetException()
Returns
Wrap(string)
Wraps a class defined in Java, and returns it as a JavaClassGodotObject type that Godot can interact with.
Note: This method only works on Android. On every other platform, this method does nothing and returns an empty JavaClass.
public static JavaClass Wrap(string name)
Parameters
name
string