# GuidedActionAutofillSupport

# GuidedActionAutofillSupport

Artifact:[androidx.leanback:leanback](https://developer.android.com/jetpack/androidx/releases/leanback)  
[View Source](https://cs.android.com/search?q=file:androidx/leanback/widget/GuidedActionAutofillSupport.java+class:androidx.leanback.widget.GuidedActionAutofillSupport)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/leanback/widget/GuidedActionAutofillSupport "View this page in Java")

<br />

```
interface GuidedActionAutofillSupport
```

<br />

Known direct subclasses  
[GuidedActionAppCompatEditText](https://developer.android.com/reference/kotlin/androidx/leanback/widget/GuidedActionAppCompatEditText),[GuidedActionEditText](https://developer.android.com/reference/kotlin/androidx/leanback/widget/GuidedActionEditText)  

|----------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
| [GuidedActionAppCompatEditText](https://developer.android.com/reference/kotlin/androidx/leanback/widget/GuidedActionAppCompatEditText) | A custom EditText that satisfies the IME key monitoring requirements of GuidedStepFragment. |
| [GuidedActionEditText](https://developer.android.com/reference/kotlin/androidx/leanback/widget/GuidedActionEditText)                   | A custom EditText that satisfies the IME key monitoring requirements of GuidedStepFragment. |

*** ** * ** ***

Interface for a custom EditText subclass to support autofill in[androidx.leanback.app.GuidedStepSupportFragment](https://developer.android.com/reference/kotlin/androidx/leanback/app/GuidedStepSupportFragment).

Apps who needs to supply custom layouts for[GuidedActionsStylist](https://developer.android.com/reference/kotlin/androidx/leanback/widget/GuidedActionsStylist)with their own EditText classes should implement this interface in order to support autofill in[androidx.leanback.app.GuidedStepSupportFragment](https://developer.android.com/reference/kotlin/androidx/leanback/app/GuidedStepSupportFragment). This ensures autofill event happened within custom EditText is propagated to GuidedStepSupportFragment. e.g.  

```kotlin
public class MyEditText extends EditText implements GuidedActionAutofillSupport {
    OnAutofillListener mAutofillViewListener;
    @Override
    public void setOnAutofillListener(OnAutofillListener autofillViewListener) {
        mAutofillViewListener = autofillViewListener;
    }

    @Override
    public void autofill(AutofillValue values) {
        super.autofill(values);
        if (mAutofillViewListener != null) {
            mAutofillViewListener.onAutofill(this);
        }
    }
    // ...
}
```

## Summary

|                                                                                                 ### Nested types                                                                                                  |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `interface `[GuidedActionAutofillSupport.OnAutofillListener](https://developer.android.com/reference/kotlin/androidx/leanback/widget/GuidedActionAutofillSupport.OnAutofillListener) Listener for autofill event. |

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [setOnAutofillListener](https://developer.android.com/reference/kotlin/androidx/leanback/widget/GuidedActionAutofillSupport#setOnAutofillListener(androidx.leanback.widget.GuidedActionAutofillSupport.OnAutofillListener))`(` ` listener: `[GuidedActionAutofillSupport.OnAutofillListener](https://developer.android.com/reference/kotlin/androidx/leanback/widget/GuidedActionAutofillSupport.OnAutofillListener)`!` `)` Sets AutofillListener on the custom view. |

## Public functions

### setOnAutofillListener

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
fun setOnAutofillListener(
    listener: GuidedActionAutofillSupport.OnAutofillListener!
): Unit
```

Sets AutofillListener on the custom view.