# AutofillManager.AutofillCallback

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# AutofillCallback

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/view/autofill/AutofillManager.AutofillCallback "View this page in Java")  

```
abstract class AutofillCallback
```

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                   ||
| ↳ | [android.view.autofill.AutofillManager.AutofillCallback](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#) |

Callback for autofill related events.

Typically used for applications that display their own "auto-complete" views, so they can enable / disable such views when the autofill UI is shown / hidden.

## Summary

|                                                                                                                                                                      Constants                                                                                                                                                                      ||
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [EVENT_INPUT_HIDDEN](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_HIDDEN:kotlin.Int) The autofill input UI associated with the view was hidden.                                              |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [EVENT_INPUT_SHOWN](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_SHOWN:kotlin.Int) The autofill input UI associated with the view was shown.                                                 |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [EVENT_INPUT_UNAVAILABLE](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_UNAVAILABLE:kotlin.Int) The autofill input UI associated with the view isn't shown because autofill is not available. |

|                                                                    Public constructors                                                                     ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [AutofillCallback](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#AutofillCallback())`()` <br /> |

|                                                                                                                                                                                                                                                                                                           Public methods                                                                                                                                                                                                                                                                                                            ||
|----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAutofillEvent](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#onAutofillEvent(android.view.View,%20kotlin.Int))`(`view:` `[View](https://developer.android.com/reference/kotlin/android/view/View.html#)`, `event:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called after a change in the autofill state associated with a view.                                                                                                                  |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAutofillEvent](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#onAutofillEvent(android.view.View,%20kotlin.Int,%20kotlin.Int))`(`view:` `[View](https://developer.android.com/reference/kotlin/android/view/View.html#)`, `virtualId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `event:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called after a change in the autofill state associated with a virtual view. |

## Constants

### EVENT_INPUT_HIDDEN

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val EVENT_INPUT_HIDDEN: Int
```

The autofill input UI associated with the view was hidden.

If the view provides its own auto-complete UI that was hidden upon a[EVENT_INPUT_SHOWN](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_SHOWN:kotlin.Int)event, it could be shown again now.  

    Value: 2

### EVENT_INPUT_SHOWN

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val EVENT_INPUT_SHOWN: Int
```

The autofill input UI associated with the view was shown.

If the view provides its own auto-complete UI and its currently shown, it should be hidden upon receiving this event.  

    Value: 1

### EVENT_INPUT_UNAVAILABLE

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val EVENT_INPUT_UNAVAILABLE: Int
```

The autofill input UI associated with the view isn't shown because autofill is not available.

If the view provides its own auto-complete UI but was not displaying it to avoid flickering, it could shown it upon receiving this event.  

    Value: 3

## Public constructors

### AutofillCallback

```
AutofillCallback()
```

## Public methods

### onAutofillEvent

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onAutofillEvent(
    view: View, 
    event: Int
): Unit
```

Called after a change in the autofill state associated with a view.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `view`  | [View](https://developer.android.com/reference/kotlin/android/view/View.html#):view associated with the change. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `event` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):currently either[EVENT_INPUT_SHOWN](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_SHOWN:kotlin.Int)or[EVENT_INPUT_HIDDEN](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_HIDDEN:kotlin.Int). Value is[android.view.autofill.AutofillManager.AutofillCallback#EVENT_INPUT_SHOWN](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_SHOWN:kotlin.Int),[android.view.autofill.AutofillManager.AutofillCallback#EVENT_INPUT_HIDDEN](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_HIDDEN:kotlin.Int), or[android.view.autofill.AutofillManager.AutofillCallback#EVENT_INPUT_UNAVAILABLE](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_UNAVAILABLE:kotlin.Int) |

### onAutofillEvent

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onAutofillEvent(
    view: View, 
    virtualId: Int, 
    event: Int
): Unit
```

Called after a change in the autofill state associated with a virtual view.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ||
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `view`      | [View](https://developer.android.com/reference/kotlin/android/view/View.html#):parent view associated with the change. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `virtualId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):id identifying the virtual child inside the parent view.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `event`     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):currently either[EVENT_INPUT_SHOWN](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_SHOWN:kotlin.Int)or[EVENT_INPUT_HIDDEN](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_HIDDEN:kotlin.Int). Value is[android.view.autofill.AutofillManager.AutofillCallback#EVENT_INPUT_SHOWN](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_SHOWN:kotlin.Int),[android.view.autofill.AutofillManager.AutofillCallback#EVENT_INPUT_HIDDEN](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_HIDDEN:kotlin.Int), or[android.view.autofill.AutofillManager.AutofillCallback#EVENT_INPUT_UNAVAILABLE](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.AutofillCallback#EVENT_INPUT_UNAVAILABLE:kotlin.Int) |