You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
JavaClassWrapper: Add example to invoke constructor
This commit is contained in:
@@ -34,6 +34,11 @@
|
|||||||
<description>
|
<description>
|
||||||
Wraps a class defined in Java, and returns it as a [JavaClass] [Object] type that Godot can interact with.
|
Wraps a class defined in Java, and returns it as a [JavaClass] [Object] type that Godot can interact with.
|
||||||
When wrapping inner (nested) classes, use [code]$[/code] instead of [code].[/code] to separate them. For example, [code]JavaClassWrapper.wrap("android.view.WindowManager$LayoutParams")[/code] wraps the [b]WindowManager.LayoutParams[/b] class.
|
When wrapping inner (nested) classes, use [code]$[/code] instead of [code].[/code] to separate them. For example, [code]JavaClassWrapper.wrap("android.view.WindowManager$LayoutParams")[/code] wraps the [b]WindowManager.LayoutParams[/b] class.
|
||||||
|
[b]Note:[/b] To invoke a constructor, call a method with the same name as the class. For example:
|
||||||
|
[codeblock]
|
||||||
|
var Intent = JavaClassWrapper.wrap("android.content.Intent")
|
||||||
|
var intent = Intent.Intent()
|
||||||
|
[/codeblock]
|
||||||
[b]Note:[/b] This method only works on Android. On every other platform, this method does nothing and returns an empty [JavaClass].
|
[b]Note:[/b] This method only works on Android. On every other platform, this method does nothing and returns an empty [JavaClass].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
Reference in New Issue
Block a user