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.Set

public method Set(fieldName: string, val: FieldType): void;

Parameters

fieldName The name of the field (e.g. int counter; would have fieldName = "counter").
val The value to assign to the field. It has to match the field type.

Description

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

The generic parameter determines the field type.

    // Create a android.text.format.Time object, and set the 'allDay' field to true.
    function Start() {
        var jo = new AndroidJavaObject("android.text.format.Time");
        jo.Set.<boolean>("allDay", true);
    }

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