# androidx.core.widget

*** ** * ** ***

## Interfaces

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/widget/NestedScrollView.OnScrollChangeListener` | Interface definition for a callback to be invoked when the scroll X or Y positions of a view change. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/TintableCompoundButton` | Interface which allows a `https://developer.android.com/reference/android/widget/CompoundButton.html` to receive tinting calls from `CompoundButtonCompat` when running on API v20 devices or lower. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/TintableCompoundDrawablesView` | Interface which allows `https://developer.android.com/reference/android/widget/TextView.html` and subclasses to tint compound drawables with `https://developer.android.com/reference/kotlin/androidx/core/widget/TextViewCompat` when running on API v22 devices or lower. |

## Classes

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/widget/AutoScrollHelper` | AutoScrollHelper is a utility class for adding automatic edge-triggered scrolling to Views. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/CheckedTextViewCompat` | Helper for accessing `https://developer.android.com/reference/android/widget/CheckedTextView.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/CompoundButtonCompat` | Helper for accessing `https://developer.android.com/reference/android/widget/CompoundButton.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/ContentLoadingProgressBar` | ContentLoadingProgressBar implements a ProgressBar that waits a minimum time to be dismissed before showing. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/EdgeEffectCompat` | Helper for accessing `https://developer.android.com/reference/android/widget/EdgeEffect.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/ImageViewCompat` | Helper for accessing features in `https://developer.android.com/reference/android/widget/ImageView.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/ListPopupWindowCompat` | Helper for accessing features in `https://developer.android.com/reference/android/widget/ListPopupWindow.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/ListViewAutoScrollHelper` | An implementation of `https://developer.android.com/reference/kotlin/androidx/core/widget/AutoScrollHelper` that knows how to scroll through a `https://developer.android.com/reference/android/widget/ListView.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/ListViewCompat` | **This class is deprecated.** Use `https://developer.android.com/reference/android/widget/ListView.html` directly. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/NestedScrollView` | NestedScrollView is just like `https://developer.android.com/reference/android/widget/ScrollView.html`, but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/PopupMenuCompat` | Helper for accessing features in `https://developer.android.com/reference/android/widget/PopupMenu.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/PopupWindowCompat` | Helper for accessing features in `https://developer.android.com/reference/android/widget/PopupWindow.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/RemoteViewsCompat.RemoteCollectionItems` | Representation of a fixed list of items to be displayed in a RemoteViews collection. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/RemoteViewsCompat.RemoteCollectionItems.Builder` | Builder class for `https://developer.android.com/reference/kotlin/androidx/core/widget/RemoteViewsCompat.RemoteCollectionItems` objects. |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/ScrollerCompat` | **This class is deprecated.** Use `https://developer.android.com/reference/android/widget/OverScroller.html` directly. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/core/widget/TextViewCompat` | Helper for accessing features in `https://developer.android.com/reference/android/widget/TextView.html`. |

## Objects

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/widget/RemoteViewsCompat` | Helper for accessing features in `https://developer.android.com/reference/android/widget/RemoteViews.html`. |

## Top-level functions summary

|---|---|
| `https://developer.android.com/reference/android/widget/RemoteViews.html` | `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#createExactSizeAppWidget(android.appwidget.AppWidgetManager,kotlin.Int,kotlin.Function1)( appWidgetManager: https://developer.android.com/reference/android/appwidget/AppWidgetManager.html, appWidgetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, factory: (https://developer.android.com/reference/kotlin/androidx/core/util/SizeFCompat) -> https://developer.android.com/reference/android/widget/RemoteViews.html )` Creates a `https://developer.android.com/reference/android/widget/RemoteViews.html` associated with each size assigned to the app widget by `https://developer.android.com/reference/android/appwidget/AppWidgetManager.html`, invoking `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#createExactSizeAppWidget(android.appwidget.AppWidgetManager,kotlin.Int,kotlin.Function1)` to create each alternative view. |
| `https://developer.android.com/reference/android/widget/RemoteViews.html` | `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#createResponsiveSizeAppWidget(android.appwidget.AppWidgetManager,kotlin.Int,kotlin.collections.Collection,kotlin.Function1)( appWidgetManager: https://developer.android.com/reference/android/appwidget/AppWidgetManager.html, appWidgetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, dpSizes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<https://developer.android.com/reference/kotlin/androidx/core/util/SizeFCompat>, factory: (https://developer.android.com/reference/kotlin/androidx/core/util/SizeFCompat) -> https://developer.android.com/reference/android/widget/RemoteViews.html )` Creating a `https://developer.android.com/reference/android/widget/RemoteViews.html` associated with each size provided in `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#createResponsiveSizeAppWidget(android.appwidget.AppWidgetManager,kotlin.Int,kotlin.collections.Collection,kotlin.Function1)`. |

## Extension functions summary

|---|---|
| `inline https://developer.android.com/reference/android/text/TextWatcher.html` | `https://developer.android.com/reference/android/widget/TextView.html.https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.widget.TextView).addTextChangedListener(kotlin.Function4,kotlin.Function4,kotlin.Function1)( crossinline beforeTextChanged: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?, start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, after: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, crossinline onTextChanged: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?, start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, before: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, crossinline afterTextChanged: (https://developer.android.com/reference/android/text/Editable.html?) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Add a text changed listener to this TextView using the provided actions |
| `inline https://developer.android.com/reference/android/text/TextWatcher.html` | `https://developer.android.com/reference/android/widget/TextView.html.https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.widget.TextView).doAfterTextChanged(kotlin.Function1)(crossinline action: (https://developer.android.com/reference/android/text/Editable.html?) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Add an action which will be invoked after the text changed. |
| `inline https://developer.android.com/reference/android/text/TextWatcher.html` | `https://developer.android.com/reference/android/widget/TextView.html.https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.widget.TextView).doBeforeTextChanged(kotlin.Function4)( crossinline action: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?, start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, after: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Add an action which will be invoked before the text changed. |
| `inline https://developer.android.com/reference/android/text/TextWatcher.html` | `https://developer.android.com/reference/android/widget/TextView.html.https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.widget.TextView).doOnTextChanged(kotlin.Function4)( crossinline action: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?, start: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, before: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Add an action which will be invoked when the text is changing. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/android/appwidget/AppWidgetManager.html.https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.Function1)( appWidgetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, factory: (https://developer.android.com/reference/kotlin/androidx/core/util/SizeFCompat) -> https://developer.android.com/reference/android/widget/RemoteViews.html )` Updates the app widget with `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.Function1)`, creating a `https://developer.android.com/reference/android/widget/RemoteViews.html` for each size assigned to the app widget by `https://developer.android.com/reference/android/appwidget/AppWidgetManager.html`, invoking `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.Function1)` to create each alternative view. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/android/appwidget/AppWidgetManager.html.https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.collections.Collection,kotlin.Function1)( appWidgetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, dpSizes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<https://developer.android.com/reference/kotlin/androidx/core/util/SizeFCompat>, factory: (https://developer.android.com/reference/kotlin/androidx/core/util/SizeFCompat) -> https://developer.android.com/reference/android/widget/RemoteViews.html )` Updates the app widget with `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.collections.Collection,kotlin.Function1)`, creating a `https://developer.android.com/reference/android/widget/RemoteViews.html` for each size provided in `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.collections.Collection,kotlin.Function1)`. |

## Top-level functions

### createExactSizeAppWidget

Artifact: [androidx.core:core-remoteviews](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/widget/AppWidgetManagerCompat.kt+function:createExactSizeAppWidget)

```
fun createExactSizeAppWidget(
    appWidgetManager: AppWidgetManager,
    appWidgetId: Int,
    factory: (SizeFCompat) -> RemoteViews
): RemoteViews
```

Creates a `https://developer.android.com/reference/android/widget/RemoteViews.html` associated with each size assigned to the app widget by `https://developer.android.com/reference/android/appwidget/AppWidgetManager.html`, invoking `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#createExactSizeAppWidget(android.appwidget.AppWidgetManager,kotlin.Int,kotlin.Function1)` to create each alternative view.

This provides ["exact" sizing](https://developer.android.com/guide/topics/appwidgets/layouts#provide-exact-layouts) , which allows you to tailor your app widget appearance to the exact size at which it is displayed. If you are only concerned with a small number of size thresholds, it is preferable to use "responsive" sizing by providing a fixed set of sizes that your app widget supports.

As your `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#createExactSizeAppWidget(android.appwidget.AppWidgetManager,kotlin.Int,kotlin.Function1)` may be invoked multiple times, if there is expensive computation of state that is shared among each size, it is recommended to perform that computation before calling this and cache the results as necessary.

To handle resizing of your app widget, it is necessary to call `https://developer.android.com/reference/android/appwidget/AppWidgetManager.html#updateAppWidget(android.content.ComponentName, android.widget.RemoteViews)` during both `https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onUpdate(android.content.Context, android.appwidget.AppWidgetManager, int[])` and `https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onAppWidgetOptionsChanged(android.content.Context, android.appwidget.AppWidgetManager, int, android.os.Bundle)`.

| Parameters |
|---|---|
| `appWidgetManager: https://developer.android.com/reference/android/appwidget/AppWidgetManager.html` | the `https://developer.android.com/reference/android/appwidget/AppWidgetManager.html` to provide information about `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#createExactSizeAppWidget(android.appwidget.AppWidgetManager,kotlin.Int,kotlin.Function1)` |
| `appWidgetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the id of the app widget |
| `factory: (https://developer.android.com/reference/kotlin/androidx/core/util/SizeFCompat) -> https://developer.android.com/reference/android/widget/RemoteViews.html` | a function to create a `https://developer.android.com/reference/android/widget/RemoteViews.html` for a given width and height (in dp) |

### createResponsiveSizeAppWidget

Artifact: [androidx.core:core-remoteviews](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/widget/AppWidgetManagerCompat.kt+function:createResponsiveSizeAppWidget)

```
fun createResponsiveSizeAppWidget(
    appWidgetManager: AppWidgetManager,
    appWidgetId: Int,
    dpSizes: Collection<SizeFCompat>,
    factory: (SizeFCompat) -> RemoteViews
): RemoteViews
```

Creating a `https://developer.android.com/reference/android/widget/RemoteViews.html` associated with each size provided in `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#createResponsiveSizeAppWidget(android.appwidget.AppWidgetManager,kotlin.Int,kotlin.collections.Collection,kotlin.Function1)`.

This provides ["responsive" sizing](https://developer.android.com/guide/topics/appwidgets/layouts#provide-responsive-layouts) , which allows for smoother resizing and a more consistent experience across different host configurations.

As your `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#createResponsiveSizeAppWidget(android.appwidget.AppWidgetManager,kotlin.Int,kotlin.collections.Collection,kotlin.Function1)` may be invoked multiple times, if there is expensive computation of state that is shared among each size, it is recommended to perform that computation before calling this and cache the results as necessary.

To handle resizing of your app widget, it is necessary to call `https://developer.android.com/reference/android/appwidget/AppWidgetManager.html#updateAppWidget(android.content.ComponentName, android.widget.RemoteViews)` during both `https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onUpdate(android.content.Context, android.appwidget.AppWidgetManager, int[])` and `https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onAppWidgetOptionsChanged(android.content.Context, android.appwidget.AppWidgetManager, int, android.os.Bundle)`. If your app's minSdk is 31 or higher, it is only necessary to call `updateAppWidget` during `onUpdate`.

| Parameters |
|---|---|
| `appWidgetManager: https://developer.android.com/reference/android/appwidget/AppWidgetManager.html` | the `https://developer.android.com/reference/android/appwidget/AppWidgetManager.html` to provide information about `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#createResponsiveSizeAppWidget(android.appwidget.AppWidgetManager,kotlin.Int,kotlin.collections.Collection,kotlin.Function1)` |
| `appWidgetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the id of the app widget |
| `dpSizes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<https://developer.android.com/reference/kotlin/androidx/core/util/SizeFCompat>` | a collection of sizes (in dp) that your app widget supports. Must not be empty or contain more than 16 elements. |
| `factory: (https://developer.android.com/reference/kotlin/androidx/core/util/SizeFCompat) -> https://developer.android.com/reference/android/widget/RemoteViews.html` | a function to create a `https://developer.android.com/reference/android/widget/RemoteViews.html` for a given width and height (in dp). It is guaranteed that `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#createResponsiveSizeAppWidget(android.appwidget.AppWidgetManager,kotlin.Int,kotlin.collections.Collection,kotlin.Function1)` will only ever be called with the values provided in `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#createResponsiveSizeAppWidget(android.appwidget.AppWidgetManager,kotlin.Int,kotlin.collections.Collection,kotlin.Function1)`. |

## Extension functions

### TextView.addTextChangedListener

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/widget/TextView.kt+function:addTextChangedListener) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
inline fun TextView.addTextChangedListener(
    crossinline beforeTextChanged: (CharSequence?, start: Int, count: Int, after: Int) -> Unit = { _, _, _, _ ->
        },
    crossinline onTextChanged: (CharSequence?, start: Int, before: Int, count: Int) -> Unit = { _, _, _, _ ->
        },
    crossinline afterTextChanged: (Editable?) -> Unit = {}
): TextWatcher
```

Add a text changed listener to this TextView using the provided actions

| Returns |
|---|---|
| `https://developer.android.com/reference/android/text/TextWatcher.html` | the `https://developer.android.com/reference/android/text/TextWatcher.html` added to the TextView |

### TextView.doAfterTextChanged

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/widget/TextView.kt+function:doAfterTextChanged) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
inline fun TextView.doAfterTextChanged(crossinline action: (Editable?) -> Unit): TextWatcher
```

Add an action which will be invoked after the text changed.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/text/TextWatcher.html` | the `https://developer.android.com/reference/android/text/TextWatcher.html` added to the TextView |

### TextView.doBeforeTextChanged

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/widget/TextView.kt+function:doBeforeTextChanged) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
inline fun TextView.doBeforeTextChanged(
    crossinline action: (CharSequence?, start: Int, count: Int, after: Int) -> Unit
): TextWatcher
```

Add an action which will be invoked before the text changed.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/text/TextWatcher.html` | the `https://developer.android.com/reference/android/text/TextWatcher.html` added to the TextView |

### TextView.doOnTextChanged

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/widget/TextView.kt+function:doOnTextChanged) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
inline fun TextView.doOnTextChanged(
    crossinline action: (CharSequence?, start: Int, before: Int, count: Int) -> Unit
): TextWatcher
```

Add an action which will be invoked when the text is changing.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/text/TextWatcher.html` | the `https://developer.android.com/reference/android/text/TextWatcher.html` added to the TextView |

### AppWidgetManager.updateAppWidget

Artifact: [androidx.core:core-remoteviews](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/widget/AppWidgetManagerCompat.kt+function:updateAppWidget)

```
fun AppWidgetManager.updateAppWidget(
    appWidgetId: Int,
    factory: (SizeFCompat) -> RemoteViews
): Unit
```

Updates the app widget with `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.Function1)`, creating a `https://developer.android.com/reference/android/widget/RemoteViews.html` for each size assigned to the app widget by `https://developer.android.com/reference/android/appwidget/AppWidgetManager.html`, invoking `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.Function1)` to create each alternative view.

This provides ["exact" sizing](https://developer.android.com/guide/topics/appwidgets/layouts#provide-exact-layouts) , which allows you to tailor your app widget appearance to the exact size at which it is displayed. If you are only concerned with a small number of size thresholds, it is preferable to use "responsive" sizing by providing a fixed set of sizes that your app widget supports.

As your `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.Function1)` may be invoked multiple times, if there is expensive computation of state that is shared among each size, it is recommended to perform that computation before calling this and cache the results as necessary.

To handle resizing of your app widget, it is necessary to call this function during both `https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onUpdate(android.content.Context, android.appwidget.AppWidgetManager, int[])` and `https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onAppWidgetOptionsChanged(android.content.Context, android.appwidget.AppWidgetManager, int, android.os.Bundle)`.

| Parameters |
|---|---|
| `appWidgetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the id of the app widget |
| `factory: (https://developer.android.com/reference/kotlin/androidx/core/util/SizeFCompat) -> https://developer.android.com/reference/android/widget/RemoteViews.html` | a function to create a `https://developer.android.com/reference/android/widget/RemoteViews.html` for a given width and height (in dp) |

### AppWidgetManager.updateAppWidget

Artifact: [androidx.core:core-remoteviews](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/widget/AppWidgetManagerCompat.kt+function:updateAppWidget)

```
fun AppWidgetManager.updateAppWidget(
    appWidgetId: Int,
    dpSizes: Collection<SizeFCompat>,
    factory: (SizeFCompat) -> RemoteViews
): Unit
```

Updates the app widget with `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.collections.Collection,kotlin.Function1)`, creating a `https://developer.android.com/reference/android/widget/RemoteViews.html` for each size provided in `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.collections.Collection,kotlin.Function1)`.

This provides ["responsive" sizing](https://developer.android.com/guide/topics/appwidgets/layouts#provide-responsive-layouts) , which allows for smoother resizing and a more consistent experience across different host configurations.

As your `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.collections.Collection,kotlin.Function1)` may be invoked multiple times, if there is expensive computation of state that is shared among each size, it is recommended to perform that computation before calling this and cache the results as necessary.

To handle resizing of your app widget, it is necessary to call this function during both `https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onUpdate(android.content.Context, android.appwidget.AppWidgetManager, int[])` and `https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onAppWidgetOptionsChanged(android.content.Context, android.appwidget.AppWidgetManager, int, android.os.Bundle)`. If your app's minSdk is 31 or higher, it is only necessary to call this function during `onUpdate`.

| Parameters |
|---|---|
| `appWidgetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the id of the app widget |
| `dpSizes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<https://developer.android.com/reference/kotlin/androidx/core/util/SizeFCompat>` | a collection of sizes (in dp) that your app widget supports. Must not be empty or contain more than 16 elements. |
| `factory: (https://developer.android.com/reference/kotlin/androidx/core/util/SizeFCompat) -> https://developer.android.com/reference/android/widget/RemoteViews.html` | a function to create a `https://developer.android.com/reference/android/widget/RemoteViews.html` for a given width and height (in dp). It is guaranteed that `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.collections.Collection,kotlin.Function1)` will only ever be called with the values provided in `https://developer.android.com/reference/kotlin/androidx/core/widget/package-summary#(android.appwidget.AppWidgetManager).updateAppWidget(kotlin.Int,kotlin.collections.Collection,kotlin.Function1)`. |