Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AndroidJavaObject

Construct an AndroidJavaObject based on the name of the class.
Read time 3 minutesLast updated 4 days ago

Definition

  • Type: Constructor
  • Namespace: UnityEngine
  • Assembly: UnityEngine.AndroidJNIModule

AndroidJavaObject(string, string[])

Construct an AndroidJavaObject based on the name of the class.
public AndroidJavaObject(string className, string[] args)

Parameters

className

Specifies the Java class name (e.g.
java.lang.String
or
java/lang/String
).

An array of
string
values, passed to the constructor as a single
String[]
argument. To call a constructor that takes multiple individual arguments, use the
params object[]
overload instead.

Remarks

Locates the class type, allocates an object, and runs the specified constructor.

AndroidJavaObject(string, AndroidJavaObject[])

Construct an AndroidJavaObject based on the name of the class.
public AndroidJavaObject(string className, AndroidJavaObject[] args)

Parameters

className

Specifies the Java class name (e.g.
java.lang.String
or
java/lang/String
).

An array of AndroidJavaObject values, passed to the constructor as a single array argument of the corresponding Java object type. To call a constructor that takes multiple individual arguments, use the
params object[]
overload instead.

Remarks

Locates the class type, allocates an object, and runs the specified constructor.

AndroidJavaObject(string, AndroidJavaClass[])

Construct an AndroidJavaObject based on the name of the class.
public AndroidJavaObject(string className, AndroidJavaClass[] args)

Parameters

className

Specifies the Java class name (e.g.
java.lang.String
or
java/lang/String
).

An array of AndroidJavaClass values, passed to the constructor as a single array argument of the corresponding Java object type. To call a constructor that takes multiple individual arguments, use the
params object[]
overload instead.

Remarks

Locates the class type, allocates an object, and runs the specified constructor.

AndroidJavaObject(string, AndroidJavaProxy[])

Construct an AndroidJavaObject based on the name of the class.
public AndroidJavaObject(string className, AndroidJavaProxy[] args)

Parameters

className

Specifies the Java class name (e.g.
java.lang.String
or
java/lang/String
).

An array of AndroidJavaProxy values, passed to the constructor as a single array argument of the corresponding Java object type. To call a constructor that takes multiple individual arguments, use the
params object[]
overload instead.

Remarks

Locates the class type, allocates an object, and runs the specified constructor.

AndroidJavaObject(string, AndroidJavaRunnable[])

Construct an AndroidJavaObject based on the name of the class.
public AndroidJavaObject(string className, AndroidJavaRunnable[] args)

Parameters

className

Specifies the Java class name (e.g.
java.lang.String
or
java/lang/String
).

args

AndroidJavaRunnable[]
An array of AndroidJavaRunnable values, passed to the constructor as a single array argument of the corresponding Java object type. To call a constructor that takes multiple individual arguments, use the
params object[]
overload instead.

Remarks

Locates the class type, allocates an object, and runs the specified constructor.

AndroidJavaObject(string, Object[])

Construct an AndroidJavaObject based on the name of the class.
public AndroidJavaObject(string className, params object[] args)

Parameters

className

Specifies the Java class name (e.g.
java.lang.String
or
java/lang/String
).

An array of parameters passed to the constructor.

Remarks

Locates the class type, allocates an object, and runs the specified constructor.

AndroidJavaObject(IntPtr)

Create AndroidJavaObject for existing Java object.
public AndroidJavaObject(nint jobject)

Parameters

jobject

A reference to existing Java object.

Remarks

Does not take ownership of passed reference, you still have to delete it.

AndroidJavaObject(IntPtr, IntPtr, Object[])

Create AndroidJavaObject (and it's Java counterpart) using given Java class and constructor.
public AndroidJavaObject(nint clazz, nint constructorID, params object[] args)

Parameters

clazz

A pointer to Java class.

constructorID

A method ID for the constructor to be used.

An array of parameters passed to the constructor.