Skip to content

Commit ea77d8a

Browse files
committed
Merge pull request #109115 from syntaxerror247/javaclasswrapper-doc
JavaClassWrapper: Add example to invoke constructor
2 parents 33c257c + 0d3516a commit ea77d8a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doc/classes/JavaClassWrapper.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
<description>
3535
Wraps a class defined in Java, and returns it as a [JavaClass] [Object] type that Godot can interact with.
3636
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.
37+
[b]Note:[/b] To invoke a constructor, call a method with the same name as the class. For example:
38+
[codeblock]
39+
var Intent = JavaClassWrapper.wrap("android.content.Intent")
40+
var intent = Intent.Intent()
41+
[/codeblock]
3742
[b]Note:[/b] This method only works on Android. On every other platform, this method does nothing and returns an empty [JavaClass].
3843
</description>
3944
</method>

0 commit comments

Comments
 (0)