className | 特定のJavaクラス名 (例: "java.lang.String " または "java/lang/String "). |
args | コンストラクタに渡されるパラメーターの配列 |
クラスの名前をベースとしたAndroidJavaObjectを作成します
これは基本的にはクラス型を見つけ、特定のコンストラクタを実行しオブジェクトを割り当てることを意味しています。
// Create a java.lang.String object holding the string "some string". function Start() { var jo = new AndroidJavaObject("java.lang.String", "some string"); }
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Start() { AndroidJavaObject jo = new AndroidJavaObject("java.lang.String", "some string"); } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): def Start() as void: jo as AndroidJavaObject = AndroidJavaObject('java.lang.String', 'some string')
// Inner (nested) classes must use /$ separators. // Here we create a LayoutParams object with a specified width and height. function Start() { var width = 300; var height = 150; var jo = new AndroidJavaObject("android/view/ViewGroup$LayoutParams", width, height); }
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Start() { int width = 300; int height = 150; AndroidJavaObject jo = new AndroidJavaObject("android/view/ViewGroup$LayoutParams", width, height); } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): def Start() as void: width as int = 300 height as int = 150 jo as AndroidJavaObject = AndroidJavaObject('android/view/ViewGroup$LayoutParams', width, height)