methodName | Specifies which method to call. |
args | An array of parameters passed to the method. |
Calls a Java method on an object (non-static).
// Create a android.content.res.Configuration object and call setToDefaults. function Start() { var jo = new AndroidJavaObject("android.content.res.Configuration"); jo.Call("setToDefaults"); }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void Start() { AndroidJavaObject jo = new AndroidJavaObject("android.content.res.Configuration"); jo.Call("setToDefaults"); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def Start() as void: jo as AndroidJavaObject = AndroidJavaObject('android.content.res.Configuration') jo.Call('setToDefaults')
methodName | Specifies which method to call. |
args | An array of parameters passed to the method. |
Call a Java method on an object.
// Create a java.lang.String object holding the string "some string", // and retrieve it's hash code. function Start() { var jo = new AndroidJavaObject("java.lang.String", "some string"); var hash = jo.Call.<int>("hashCode"); }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void Start() { AndroidJavaObject jo = new AndroidJavaObject("java.lang.String", "some string"); int hash = jo.Call<int>("hashCode"); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def Start() as void: jo as AndroidJavaObject = AndroidJavaObject('java.lang.String', 'some string') hash as int = jo.Call[of int]('hashCode')