ContextParams.Builder | API reference | Android Developers (original) (raw)
class Builder
Builder for creating a [ContextParams](/reference/kotlin/android/content/ContextParams)
.
Summary
Public constructors |
---|
Builder() Create a new builder. |
Builder(params: ContextParams) Create a new builder that inherits all sub-parameters by default. |
Public methods | |
---|---|
ContextParams | build() Creates a new instance. |
ContextParams.Builder | setAttributionTag(attributionTag: String?) Sets an attribution tag against which to track permission accesses. |
ContextParams.Builder | setNextAttributionSource(next: AttributionSource?) Sets the attribution source for the app on whose behalf you are doing the work. |
ContextParams.Builder | setShouldRegisterAttributionSource(shouldRegister: Boolean) Sets whether the attribution source associated with the context created from these params should be registered. |
Public constructors
Builder
Builder()
Create a new builder.
This is valuable when you are interested in having explicit control over every sub-parameter, and don't want to inherit any values from an existing Context.
Developers should strongly consider using [Builder(android.content.ContextParams)](#Builder%28android.content.ContextParams%29)
instead of this constructor, since that will will automatically inherit any new sub-parameters added in future platform releases.
Builder
Builder(params: ContextParams)
Create a new builder that inherits all sub-parameters by default.
This is valuable when you are only interested in overriding specific sub-parameters, and want to preserve all other parameters. Setting a specific sub-parameter on the returned builder will override any inherited value.
Parameters | |
---|---|
params | ContextParams: This value cannot be null. |
Public methods
setAttributionTag
fun setAttributionTag(attributionTag: String?): ContextParams.Builder
Sets an attribution tag against which to track permission accesses.
Parameters | |
---|---|
attributionTag | String?: The attribution tag. This value may be null. |
Return | |
---|---|
ContextParams.Builder | This builder. This value cannot be null. |
setShouldRegisterAttributionSource
fun setShouldRegisterAttributionSource(shouldRegister: Boolean): ContextParams.Builder
Sets whether the attribution source associated with the context created from these params should be registered.
Parameters | |
---|---|
shouldRegister | Boolean: Whether the attribution source associated with the Context being created should be registered. |
Return | |
---|---|
ContextParams.Builder | This value cannot be null. |
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.