# AndroidJavaObject

> Construct an AndroidJavaObject based on the name of the class.

## Definition

* **Type:** Constructor
* **Namespace:** [UnityEngine](/engine/7000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.AndroidJNIModule

## AndroidJavaObject(string, string\[])

Construct an AndroidJavaObject based on the name of the class.

```csharp
public AndroidJavaObject(string className, string[] args)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Specifies the Java class name (e.g. `java.lang.String` or `java/lang/String`).**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.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.

```csharp
public AndroidJavaObject(string className, AndroidJavaObject[] args)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Specifies the Java class name (e.g. `java.lang.String` or `java/lang/String`).**** (\[AndroidJavaObject\[]]\(/engine/7000.0/script-reference/unityengine/androidjavaobject)): An array of [AndroidJavaObject](/engine/7000.0/script-reference/unityengine/androidjavaobject.md) 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.

```csharp
public AndroidJavaObject(string className, AndroidJavaClass[] args)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Specifies the Java class name (e.g. `java.lang.String` or `java/lang/String`).**** (\[AndroidJavaClass\[]]\(/engine/7000.0/script-reference/unityengine/androidjavaclass)): An array of [AndroidJavaClass](/engine/7000.0/script-reference/unityengine/androidjavaclass.md) 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.

```csharp
public AndroidJavaObject(string className, AndroidJavaProxy[] args)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Specifies the Java class name (e.g. `java.lang.String` or `java/lang/String`).**** (\[AndroidJavaProxy\[]]\(/engine/7000.0/script-reference/unityengine/androidjavaproxy)): An array of [AndroidJavaProxy](/engine/7000.0/script-reference/unityengine/androidjavaproxy.md) 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.

```csharp
public AndroidJavaObject(string className, AndroidJavaRunnable[] args)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Specifies the Java class name (e.g. `java.lang.String` or `java/lang/String`).**** (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.

```csharp
public AndroidJavaObject(string className, params object[] args)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Specifies the Java class name (e.g. `java.lang.String` or `java/lang/String`).**** (\[Object\[]]\(https\://learn.microsoft.com/dotnet/api/system.object)): 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.

```csharp
public AndroidJavaObject(nint jobject)
```

### Parameters

**** (\[IntPtr]\(https\://learn.microsoft.com/dotnet/api/system.intptr)): 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.

```csharp
public AndroidJavaObject(nint clazz, nint constructorID, params object[] args)
```

### Parameters

**** (\[IntPtr]\(https\://learn.microsoft.com/dotnet/api/system.intptr)): A pointer to Java class.**** (\[IntPtr]\(https\://learn.microsoft.com/dotnet/api/system.intptr)): A method ID for the constructor to be used.**** (\[Object\[]]\(https\://learn.microsoft.com/dotnet/api/system.object)): An array of parameters passed to the constructor.
