Added in API level 31

Builder

class Builder
kotlin.Any
   ↳ android.widget.RemoteViews.RemoteCollectionItems.Builder

Builder class for RemoteCollectionItems objects.

Summary

Public constructors

Public methods
RemoteViews.RemoteCollectionItems.Builder
addItem(id: Long, view: RemoteViews)

Adds a RemoteViews to the collection.

RemoteViews.RemoteCollectionItems

Creates the RemoteCollectionItems defined by this builder.

RemoteViews.RemoteCollectionItems.Builder
setHasStableIds(hasStableIds: Boolean)

Sets whether the item ids are stable across changes to the underlying data.

RemoteViews.RemoteCollectionItems.Builder
setViewTypeCount(viewTypeCount: Int)

Sets the view type count for the collection when used in an adapter.

Public constructors

Builder

Builder()

Public methods

addItem

Added in API level 31
fun addItem(
    id: Long,
    view: RemoteViews
): RemoteViews.RemoteCollectionItems.Builder

Adds a RemoteViews to the collection.

Parameters
id Long: Id to associate with the row. Use setHasStableIds(boolean) to indicate that ids are stable across changes to the collection.
view RemoteViews: RemoteViews to display for the row. This value cannot be null.
Return
RemoteViews.RemoteCollectionItems.Builder This value cannot be null.

build

Added in API level 31
fun build(): RemoteViews.RemoteCollectionItems

Creates the RemoteCollectionItems defined by this builder.

Return
RemoteViews.RemoteCollectionItems This value cannot be null.

setHasStableIds

Added in API level 31
fun setHasStableIds(hasStableIds: Boolean): RemoteViews.RemoteCollectionItems.Builder

Sets whether the item ids are stable across changes to the underlying data.

Return
RemoteViews.RemoteCollectionItems.Builder This value cannot be null.

setViewTypeCount

Added in API level 31
fun setViewTypeCount(viewTypeCount: Int): RemoteViews.RemoteCollectionItems.Builder

Sets the view type count for the collection when used in an adapter. This can be set to the maximum number of different layout ids that will be used by RemoteViews in this collection. If this value is not set, then a value will be inferred from the provided items. As a result, the adapter may need to be recreated when the list is updated with previously unseen RemoteViews layouts for new items.

Return
RemoteViews.RemoteCollectionItems.Builder This value cannot be null.