JavaClassWrapper
Inherits:Object
Provides access to the Java Native Interface.
Description
The JavaClassWrapper singleton provides a way for the Godot application to send and receive data through theJava Native Interface (JNI).
Note: This singleton is only available in Android builds.
varLocalDateTime=JavaClassWrapper.wrap("java.time.LocalDateTime")varDateTimeFormatter=JavaClassWrapper.wrap("java.time.format.DateTimeFormatter")vardatetime=LocalDateTime.now()varformatter=DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss")print(datetime.format(formatter))
Warning: When calling Java methods, be sure to checkget_exception() to check if the method threw an exception.
Methods
Method Descriptions
JavaObjectget_exception()🔗
Returns the Java exception from the last call into a Java class. If there was no exception, it will returnnull
.
Note: This method only works on Android. On every other platform, this method will always returnnull
.
Wraps a class defined in Java, and returns it as aJavaClassObject type that Godot can interact with.
Note: This method only works on Android. On every other platform, this method does nothing and returns an emptyJavaClass.