Added in API level 19

CollectionInfo


class CollectionInfo
kotlin.Any
   ↳ android.view.accessibility.AccessibilityNodeInfo.CollectionInfo

Class with information if a node is a collection.

A collection of items has rows and columns and may be hierarchical. For example, a horizontal list is a collection with one column, as many rows as the list items, and is not hierarchical; A table is a collection with several rows, several columns, and is not hierarchical; A vertical tree is a hierarchical collection with one column and as many rows as the first level children.

Summary

Nested classes

The builder for CollectionInfo.

Constants
static Int

Selection mode where multiple items may be selected.

static Int

Selection mode where items are not selectable.

static Int

Selection mode where a single item may be selected.

static Int

Constant to denote a missing collection count.

Public constructors
CollectionInfo(rowCount: Int, columnCount: Int, hierarchical: Boolean)

Creates a new instance.

CollectionInfo(rowCount: Int, columnCount: Int, hierarchical: Boolean, selectionMode: Int)

Creates a new instance.

Public methods
Int

Gets the number of columns.

Int

Gets the number of items in the collection considered important for accessibility.

Int

Gets the number of items in the collection.

Int

Gets the number of rows.

Int

Gets the collection's selection mode.

Boolean

Gets if the collection is a hierarchically ordered.

static AccessibilityNodeInfo.CollectionInfo!
obtain(rowCount: Int, columnCount: Int, hierarchical: Boolean)

Obtains a pooled instance.

static AccessibilityNodeInfo.CollectionInfo!
obtain(rowCount: Int, columnCount: Int, hierarchical: Boolean, selectionMode: Int)

Obtains a pooled instance.

Constants

SELECTION_MODE_MULTIPLE

Added in API level 21
static val SELECTION_MODE_MULTIPLE: Int

Selection mode where multiple items may be selected.

Value: 2

SELECTION_MODE_NONE

Added in API level 21
static val SELECTION_MODE_NONE: Int

Selection mode where items are not selectable.

Value: 0

SELECTION_MODE_SINGLE

Added in API level 21
static val SELECTION_MODE_SINGLE: Int

Selection mode where a single item may be selected.

Value: 1

UNDEFINED

Added in API level 35
static val UNDEFINED: Int

Constant to denote a missing collection count. This should be used for mItemCount and mImportantForAccessibilityItemCount when values for those fields are not known.

Value: -1

Public constructors

CollectionInfo

Added in API level 30
CollectionInfo(
    rowCount: Int,
    columnCount: Int,
    hierarchical: Boolean)

Creates a new instance.

Parameters
rowCount Int: The number of rows.
columnCount Int: The number of columns.
hierarchical Boolean: Whether the collection is hierarchical.

CollectionInfo

Added in API level 30
CollectionInfo(
    rowCount: Int,
    columnCount: Int,
    hierarchical: Boolean,
    selectionMode: Int)

Creates a new instance.

Parameters
rowCount Int: The number of rows.
columnCount Int: The number of columns.
hierarchical Boolean: Whether the collection is hierarchical.
selectionMode Int: The collection's selection mode.

Public methods

getColumnCount

Added in API level 19
fun getColumnCount(): Int

Gets the number of columns.

Return
Int The column count, or -1 if count is unknown.

getImportantForAccessibilityItemCount

Added in API level 35
fun getImportantForAccessibilityItemCount(): Int

Gets the number of items in the collection considered important for accessibility.

Return
Int The count of items important for accessibility, which may be UNDEFINED if the count is not known.

getItemCount

Added in API level 35
fun getItemCount(): Int

Gets the number of items in the collection.

Return
Int The count of items, which may be UNDEFINED if the count is not known.

getRowCount

Added in API level 19
fun getRowCount(): Int

Gets the number of rows.

Return
Int The row count, or -1 if count is unknown.

getSelectionMode

Added in API level 21
fun getSelectionMode(): Int

Gets the collection's selection mode.

Return
Int The collection's selection mode, one of:

isHierarchical

Added in API level 19
fun isHierarchical(): Boolean

Gets if the collection is a hierarchically ordered.

Return
Boolean Whether the collection is hierarchical.

obtain

Added in API level 19
Deprecated in API level 33
static fun obtain(
    rowCount: Int,
    columnCount: Int,
    hierarchical: Boolean
): AccessibilityNodeInfo.CollectionInfo!

Deprecated: Object pooling has been discontinued. Create a new instance using the constructor android.view.accessibility.AccessibilityNodeInfo.CollectionInfo#CollectionInfo(int,int,boolean) instead.

Obtains a pooled instance.

Parameters
rowCount Int: The number of rows, or -1 if count is unknown.
columnCount Int: The number of columns, or -1 if count is unknown.
hierarchical Boolean: Whether the collection is hierarchical.

obtain

Added in API level 21
Deprecated in API level 33
static fun obtain(
    rowCount: Int,
    columnCount: Int,
    hierarchical: Boolean,
    selectionMode: Int
): AccessibilityNodeInfo.CollectionInfo!

Deprecated: Object pooling has been discontinued. Create a new instance using the constructor android.view.accessibility.AccessibilityNodeInfo.CollectionInfo#CollectionInfo(int,int,boolean,int) instead.

Obtains a pooled instance.

Parameters
rowCount Int: The number of rows.
columnCount Int: The number of columns.
hierarchical Boolean: Whether the collection is hierarchical.
selectionMode Int: The collection's selection mode, one of: