# AccessibilityNodeInfo.CollectionInfo

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# CollectionInfo

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo "View this page in Java")  

```
class CollectionInfo
```

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                                     ||
| ↳ | [android.view.accessibility.AccessibilityNodeInfo.CollectionInfo](https://developer.android.com/reference/kotlin/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                                                                            ||
|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|   | [Builder](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo.Builder) The builder for CollectionInfo. |

|                                                                                                                                                      Constants                                                                                                                                                      ||
|----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SELECTION_MODE_MULTIPLE](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#SELECTION_MODE_MULTIPLE:kotlin.Int) Selection mode where multiple items may be selected. |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SELECTION_MODE_NONE](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#SELECTION_MODE_NONE:kotlin.Int) Selection mode where items are not selectable.               |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SELECTION_MODE_SINGLE](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#SELECTION_MODE_SINGLE:kotlin.Int) Selection mode where a single item may be selected.      |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [UNDEFINED](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#UNDEFINED:kotlin.Int) Constant to denote a missing collection count.                                   |

|                                                                                                                                                                                                                                                                                                        Public constructors                                                                                                                                                                                                                                                                                                         ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [CollectionInfo](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#CollectionInfo(kotlin.Int,%20kotlin.Int,%20kotlin.Boolean))`(`rowCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `columnCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `hierarchical:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Creates a new instance.                                                                                                              |
| [CollectionInfo](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#CollectionInfo(kotlin.Int,%20kotlin.Int,%20kotlin.Boolean,%20kotlin.Int))`(`rowCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `columnCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `hierarchical:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`, `selectionMode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Creates a new instance. |

|                                                                                                                                                                                                                                                                                                                                                                                   Public methods                                                                                                                                                                                                                                                                                                                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                     | [getColumnCount](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#getColumnCount())`()` Gets the number of columns.                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                     | [getImportantForAccessibilityItemCount](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#getImportantForAccessibilityItemCount())`()` Gets the number of items in the collection considered important for accessibility.                                                                                                                                                                                                                                                                                                                             |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                     | [getItemCount](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#getItemCount())`()` Gets the number of items in the collection.                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                     | [getRowCount](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#getRowCount())`()` Gets the number of rows.                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                     | [getSelectionMode](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#getSelectionMode())`()` Gets the collection's selection mode.                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                             | [isHierarchical](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#isHierarchical())`()` Gets if the collection is a hierarchically ordered.                                                                                                                                                                                                                                                                                                                                                                                                          |
| static[AccessibilityNodeInfo.CollectionInfo](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#)! | [obtain](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#obtain(kotlin.Int,%20kotlin.Int,%20kotlin.Boolean))`(`rowCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `columnCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `hierarchical:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Obtains a pooled instance.                                                                                                              |
| static[AccessibilityNodeInfo.CollectionInfo](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#)! | [obtain](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#obtain(kotlin.Int,%20kotlin.Int,%20kotlin.Boolean,%20kotlin.Int))`(`rowCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `columnCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `hierarchical:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`, `selectionMode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Obtains a pooled instance. |

## Constants

### SELECTION_MODE_MULTIPLE

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val SELECTION_MODE_MULTIPLE: Int
```

Selection mode where multiple items may be selected.  

    Value: 2

### SELECTION_MODE_NONE

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val SELECTION_MODE_NONE: Int
```

Selection mode where items are not selectable.  

    Value: 0

### SELECTION_MODE_SINGLE

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val SELECTION_MODE_SINGLE: Int
```

Selection mode where a single item may be selected.  

    Value: 1

### UNDEFINED

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

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

Creates a new instance.

|                                                                 Parameters                                                                 ||
|----------------|----------------------------------------------------------------------------------------------------------------------------|
| `rowCount`     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The number of rows.                             |
| `columnCount`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The number of columns.                          |
| `hierarchical` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):Whether the collection is hierarchical. |

### CollectionInfo

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

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

Creates a new instance.

|                                                                 Parameters                                                                  ||
|-----------------|----------------------------------------------------------------------------------------------------------------------------|
| `rowCount`      | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The number of rows.                             |
| `columnCount`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The number of columns.                          |
| `hierarchical`  | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):Whether the collection is hierarchical. |
| `selectionMode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The collection's selection mode.                |

## Public methods

### getColumnCount

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getColumnCount(): Int
```

Gets the number of columns.

|                                                          Return                                                          ||
|----------------------------------------------------------------------------|----------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The column count, or -1 if count is unknown. |

### getImportantForAccessibilityItemCount

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getImportantForAccessibilityItemCount(): Int
```

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

|                                                                                    Return                                                                                     ||
|----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The count of items important for accessibility, which may be`UNDEFINED`if the count is not known. |

### getItemCount

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getItemCount(): Int
```

Gets the number of items in the collection.

|                                                                      Return                                                                       ||
|----------------------------------------------------------------------------|-----------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The count of items, which may be`UNDEFINED`if the count is not known. |

### getRowCount

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getRowCount(): Int
```

Gets the number of rows.

|                                                        Return                                                         ||
|----------------------------------------------------------------------------|-------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The row count, or -1 if count is unknown. |

### getSelectionMode

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSelectionMode(): Int
```

Gets the collection's selection mode.

|                                                                                                                                                                                                                                                                                                                        Return                                                                                                                                                                                                                                                                                                                         ||
|----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The collection's selection mode, one of: - [SELECTION_MODE_NONE](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#SELECTION_MODE_NONE:kotlin.Int) - [SELECTION_MODE_SINGLE](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#SELECTION_MODE_SINGLE:kotlin.Int) - [SELECTION_MODE_MULTIPLE](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#SELECTION_MODE_MULTIPLE:kotlin.Int) |

### isHierarchical

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun isHierarchical(): Boolean
```

Gets if the collection is a hierarchically ordered.

|                                                           Return                                                            ||
|------------------------------------------------------------------------------------|-----------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | Whether the collection is hierarchical. |

### obtain

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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)](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#CollectionInfo(kotlin.Int,%20kotlin.Int,%20kotlin.Boolean))instead.*

Obtains a pooled instance.

|                                                                  Parameters                                                                  ||
|----------------|------------------------------------------------------------------------------------------------------------------------------|
| `rowCount`     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The number of rows, or -1 if count is unknown.    |
| `columnCount`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The number of columns, or -1 if count is unknown. |
| `hierarchical` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):Whether the collection is hierarchical.   |

### obtain

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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)](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#CollectionInfo(kotlin.Int,%20kotlin.Int,%20kotlin.Boolean,%20kotlin.Int))instead.*

Obtains a pooled instance.

|                                                                                                                                                                                                                                                                                                                              Parameters                                                                                                                                                                                                                                                                                                                               ||
|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `rowCount`      | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The number of rows.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `columnCount`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The number of columns.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `hierarchical`  | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):Whether the collection is hierarchical.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `selectionMode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The collection's selection mode, one of: - [SELECTION_MODE_NONE](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#SELECTION_MODE_NONE:kotlin.Int) - [SELECTION_MODE_SINGLE](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#SELECTION_MODE_SINGLE:kotlin.Int) - [SELECTION_MODE_MULTIPLE](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.CollectionInfo#SELECTION_MODE_MULTIPLE:kotlin.Int) |