Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder class for RemoteCollectionItems
objects.
Summary
Public constructors
Public methods
setViewTypeCount
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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# RemoteViews.RemoteCollectionItems.Builder\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/widget/RemoteViews.RemoteCollectionItems.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|---------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.widget.RemoteViews.RemoteCollectionItems.Builder](#) |\n\nBuilder class for [RemoteCollectionItems](/reference/kotlin/android/widget/RemoteViews.RemoteCollectionItems) objects.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------|---|\n| [Builder](#Builder())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [RemoteViews.RemoteCollectionItems.Builder](#) | [addItem](#addItem(kotlin.Long,%20android.widget.RemoteViews))`(`id:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, `view:` `[RemoteViews](/reference/kotlin/android/widget/RemoteViews)`)` Adds a [RemoteViews](/reference/kotlin/android/widget/RemoteViews) to the collection. |\n| [RemoteViews.RemoteCollectionItems](/reference/kotlin/android/widget/RemoteViews.RemoteCollectionItems) | [build](#build())`()` Creates the [RemoteCollectionItems](/reference/kotlin/android/widget/RemoteViews.RemoteCollectionItems) defined by this builder. |\n| [RemoteViews.RemoteCollectionItems.Builder](#) | [setHasStableIds](#setHasStableIds(kotlin.Boolean))`(`hasStableIds:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets whether the item ids are stable across changes to the underlying data. |\n| [RemoteViews.RemoteCollectionItems.Builder](#) | [setViewTypeCount](#setViewTypeCount(kotlin.Int))`(`viewTypeCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the view type count for the collection when used in an adapter. |\n\nPublic constructors\n-------------------\n\n### Builder\n\n```\nBuilder()\n```\n\nPublic methods\n--------------\n\n### addItem\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun addItem(\n id: Long, \n view: RemoteViews\n): RemoteViews.RemoteCollectionItems.Builder\n```\n\nAdds a [RemoteViews](/reference/kotlin/android/widget/RemoteViews) to the collection.\n\n| Parameters ||\n|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `id` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): Id to associate with the row. Use [setHasStableIds(boolean)](#setHasStableIds(kotlin.Boolean)) to indicate that ids are stable across changes to the collection. |\n| `view` | [RemoteViews](/reference/kotlin/android/widget/RemoteViews): RemoteViews to display for the row. This value cannot be `null`. |\n\n| Return ||\n|------------------------------------------------|------------------------------|\n| [RemoteViews.RemoteCollectionItems.Builder](#) | This value cannot be `null`. |\n\n### build\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): RemoteViews.RemoteCollectionItems\n```\n\nCreates the [RemoteCollectionItems](/reference/kotlin/android/widget/RemoteViews.RemoteCollectionItems) defined by this builder.\n\n| Return ||\n|---------------------------------------------------------------------------------------------------------|------------------------------|\n| [RemoteViews.RemoteCollectionItems](/reference/kotlin/android/widget/RemoteViews.RemoteCollectionItems) | This value cannot be `null`. |\n\n### setHasStableIds\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setHasStableIds(hasStableIds: Boolean): RemoteViews.RemoteCollectionItems.Builder\n```\n\nSets whether the item ids are stable across changes to the underlying data.\n\n| Return ||\n|------------------------------------------------|------------------------------|\n| [RemoteViews.RemoteCollectionItems.Builder](#) | This value cannot be `null`. |\n\n**See Also**\n\n- [android.widget.Adapter#hasStableIds()](/reference/kotlin/android/widget/Adapter#hasStableIds()) \n\n### setViewTypeCount\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setViewTypeCount(viewTypeCount: Int): RemoteViews.RemoteCollectionItems.Builder\n```\n\nSets 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.\n\n| Return ||\n|------------------------------------------------|------------------------------|\n| [RemoteViews.RemoteCollectionItems.Builder](#) | This value cannot be `null`. |\n\n**See Also**\n\n- [android.widget.Adapter#getViewTypeCount()](/reference/kotlin/android/widget/Adapter#getViewTypeCount())"]]