Version: 2017.3 (switch to 2017.4)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

AndroidJavaObject.Get

public method Get(fieldName: string): FieldType;

Parameters

fieldName The name of the field (e.g. int counter; would have fieldName = "counter").

Description

Get the value of a field in an object (non-static).

The generic parameter determines the field type.

    // Create a android.os.Message object, and retrieve the default value of the field 'what'.
    function Start() {
        var jo = new AndroidJavaObject("android.os.Message");
        var valueString = jo.Get.<int>("what");
    }

Did you find this page useful? Please give it a rating: