Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ScriptGroup.Closure\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nClosure\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/renderscript/ScriptGroup.Closure \"View this page in Java\") \n\n```\nclass Closure : BaseObj\n```\n\n|---|---|-----------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||\n| ↳ | [android.renderscript.BaseObj](/reference/kotlin/android/renderscript/BaseObj) ||\n| | ↳ | [android.renderscript.ScriptGroup.Closure](#) |\n\n*** ** * ** ***\n\n| **This class was deprecated in API level 31.**\n|\n| Deprecated in Java.\n\nAn opaque class for closures\n\nA closure represents a function call to a kernel or invocable function, combined with arguments and values for global variables. A closure is created using the [android.renderscript.ScriptGroup.Builder2#addKernel](/reference/kotlin/android/renderscript/ScriptGroup.Builder2#addKernel(android.renderscript.Script.KernelID,%20android.renderscript.Type,%20kotlin.Any)) or [android.renderscript.ScriptGroup.Builder2#addInvoke](/reference/kotlin/android/renderscript/ScriptGroup.Builder2#addInvoke(android.renderscript.Script.InvokeID,%20kotlin.Any)) method.\n\nSummary\n-------\n\n| Public methods ||\n|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [destroy](#destroy())`()` Destroys this Closure and the Allocation for its return value |\n| [ScriptGroup.Future](/reference/kotlin/android/renderscript/ScriptGroup.Future)! | [getGlobal](#getGlobal(android.renderscript.Script.FieldID))`(`field:` `[Script.FieldID](/reference/kotlin/android/renderscript/Script.FieldID)!`)` Returns the future for a global variable |\n| [ScriptGroup.Future](/reference/kotlin/android/renderscript/ScriptGroup.Future)! | [getReturn](#getReturn())`()` Returns the future for the return value |\n\n| Protected methods ||\n|------------------------------------------------------------------------------|------------------------------------|\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [finalize](#finalize())`()` \u003cbr /\u003e |\n\n| Inherited functions ||\n|---|---|\n| From class [BaseObj](/reference/kotlin/android/renderscript/BaseObj) |------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [equals](/reference/kotlin/android/renderscript/BaseObj#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` Compare the current BaseObj with another BaseObj for equality. \u003cbr /\u003e | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getName](/reference/kotlin/android/renderscript/BaseObj#getName())`()` \u003cbr /\u003e | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [hashCode](/reference/kotlin/android/renderscript/BaseObj#hashCode())`()` Calculates the hash code value for a BaseObj. \u003cbr /\u003e | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setName](/reference/kotlin/android/renderscript/BaseObj#setName(kotlin.String))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` setName assigns a name to an object. This object can later be looked up by this name. \u003cbr /\u003e | ||\n\nPublic methods\n--------------\n\n### destroy\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun destroy(): Unit\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nDestroys this Closure and the Allocation for its return value \n\n### getGlobal\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getGlobal(field: Script.FieldID!): ScriptGroup.Future!\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nReturns the future for a global variable\n\n| Parameters ||\n|---------|----------------------------------------------------------------------------------------------------------------|\n| `field` | [Script.FieldID](/reference/kotlin/android/renderscript/Script.FieldID)!: the field ID for the global variable |\n\n| Return ||\n|----------------------------------------------------------------------------------|----------|\n| [ScriptGroup.Future](/reference/kotlin/android/renderscript/ScriptGroup.Future)! | a future |\n\n### getReturn\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getReturn(): ScriptGroup.Future!\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nReturns the future for the return value\n\n| Return ||\n|----------------------------------------------------------------------------------|----------|\n| [ScriptGroup.Future](/reference/kotlin/android/renderscript/ScriptGroup.Future)! | a future |\n\nProtected methods\n-----------------\n\n### finalize\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected fun finalize(): Unit\n```\n\n**Deprecated:** *Deprecated in Java.*\n\n| Exceptions ||\n|-----------------------|---------------------------------------|\n| `java.lang.Throwable` | the `Exception` raised by this method |"]]