{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

AutofillNode

@ExperimentalComposeUiApi
public final class AutofillNode


Every autofillable composable will have an AutofillNode. (An autofill node will be created for every semantics node that adds autofill properties). This node is used to request/cancel autofill, and it holds the onFill lambda which is called by the autofill framework.

Summary

Public constructors

AutofillNode(
    @NonNull List<@NonNull AutofillType> autofillTypes,
    Rect boundingBox,
    Function1<@NonNull StringUnit> onFill
)

Public methods

boolean
equals(Object other)
final @NonNull List<@NonNull AutofillType>

A list of autofill types for this node.

final Rect

The screen coordinates of the composable being autofilled.

final int

A virtual id that is automatically generated for each node.

final Function1<@NonNull StringUnit>

The callback that is called by the autofill framework to perform autofill.

int
final void
setBoundingBox(Rect boundingBox)

The screen coordinates of the composable being autofilled.

Public constructors

AutofillNode

public AutofillNode(
    @NonNull List<@NonNull AutofillType> autofillTypes,
    Rect boundingBox,
    Function1<@NonNull StringUnit> onFill
)

Public methods

equals

public boolean equals(Object other)

getAutofillTypes

public final @NonNull List<@NonNull AutofillTypegetAutofillTypes()

A list of autofill types for this node. These types are conveyed to the autofill framework and it is used to call onFill with the appropriate value. If you don't set this property, the autofill framework will use heuristics to guess the type. This property is a list because some fields can have multiple types. For instance, userid in a login form can either be a username or an email address. TODO(b/138731416): Check with the autofill service team if the order matters, and how duplicate types are handled.

getBoundingBox

public final Rect getBoundingBox()

The screen coordinates of the composable being autofilled. This data is used by the autofill framework to decide where to show the autofill popup.

getId

public final int getId()

A virtual id that is automatically generated for each node.

getOnFill

public final Function1<@NonNull StringUnitgetOnFill()

The callback that is called by the autofill framework to perform autofill.

hashCode

public int hashCode()

setBoundingBox

public final void setBoundingBox(Rect boundingBox)

The screen coordinates of the composable being autofilled. This data is used by the autofill framework to decide where to show the autofill popup.