Stay organized with collections
Save and categorize content based on your preferences.
Field
class Field
This class is used to set all information of a field. Such as the AutofillValue
to be autofilled, a explicit filter, and presentations to be visualized, etc.
Summary
Nested classes |
|
A builder for Field
|
Public methods |
Pattern? |
Regex used to determine if the dataset should be shown in the autofill UI; when null , it disables filtering on that dataset (this is the recommended approach when value is not null and field contains sensitive data such as passwords).
|
Presentations? |
The presentations used to visualize this field in Autofill UI.
|
AutofillValue? |
The value to be autofilled.
|
Public methods
getFilter
fun getFilter(): Pattern?
Regex used to determine if the dataset should be shown in the autofill UI; when null
, it disables filtering on that dataset (this is the recommended approach when value
is not null
and field contains sensitive data such as passwords).
getPresentations
fun getPresentations(): Presentations?
The presentations used to visualize this field in Autofill UI.
getValue
fun getValue(): AutofillValue?
The value to be autofilled. Pass null
if you do not have the value but the target view is a logical part of the dataset. For example, if the dataset needs authentication and you have no access to the value.
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,["# Field\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nField\n=====\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/service/autofill/Field \"View this page in Java\") \n\n```\nclass Field\n```\n\n|---|-------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.service.autofill.Field](#) |\n\nThis class is used to set all information of a field. Such as the [AutofillValue](../../view/autofill/AutofillValue.html#) to be autofilled, a [explicit filter](#Filtering), and presentations to be visualized, etc.\n\nSummary\n-------\n\n| Nested classes ||\n|---|----------------------------------------------------------------------------------------------|\n| | [Builder](/reference/kotlin/android/service/autofill/Field.Builder) A builder for [Field](#) |\n\n| Public methods ||\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Pattern](../../../java/util/regex/Pattern.html#)? | [getFilter](#getFilter())`()` Regex used to determine if the dataset should be shown in the autofill UI; when `null`, it disables filtering on that dataset (this is the recommended approach when `value` is not `null` and field contains sensitive data such as passwords). |\n| [Presentations](/reference/kotlin/android/service/autofill/Presentations)? | [getPresentations](#getPresentations())`()` The presentations used to visualize this field in Autofill UI. |\n| [AutofillValue](../../view/autofill/AutofillValue.html#)? | [getValue](#getValue())`()` The value to be autofilled. |\n\nPublic methods\n--------------\n\n### getFilter\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getFilter(): Pattern?\n```\n\nRegex used to determine if the dataset should be shown in the autofill UI; when `null`, it disables filtering on that dataset (this is the recommended approach when `value` is not `null` and field contains sensitive data such as passwords). \n\n### getPresentations\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getPresentations(): Presentations?\n```\n\nThe presentations used to visualize this field in Autofill UI.\n\n| Return ||\n|----------------------------------------------------------------------------|---------------------------|\n| [Presentations](/reference/kotlin/android/service/autofill/Presentations)? | This value may be `null`. |\n\n### getValue\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getValue(): AutofillValue?\n```\n\nThe value to be autofilled. Pass `null` if you do not have the value but the target view is a logical part of the dataset. For example, if the dataset needs authentication and you have no access to the value."]]