言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

AndroidJavaObject.AndroidJavaObject

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public function AndroidJavaObject(className: string, params args: object[])
public AndroidJavaObject(string className, params object[] args);
public def AndroidJavaObject(className as string, *args as object[])

Parameters

className 特定のJavaクラス名 (例: "java.lang.String" または "java/lang/String").
args コンストラクタに渡されるパラメーターの配列

Description

クラスの名前をベースとした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)

Description