# AccessibilityNodeInfoCompat.CollectionItemInfoCompat

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java+class:androidx.core.view.accessibility.AccessibilityNodeInfoCompat.CollectionItemInfoCompat) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat "View this page in Java")


```
class AccessibilityNodeInfoCompat.CollectionItemInfoCompat
```

<br />

*** ** * ** ***

Class with information if a node is a collection item.

A collection item is contained in a collection, it starts at a given row and column in the collection, and spans one or more rows and columns. For example, a header of two related table columns starts at the first row and the first column, spans one row and two columns.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat.Builder` Builder for creating `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat` objects. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#SORT_DIRECTION_ASCENDING() = 1` Items are sorted in ascending order (e.g., A-Z, 0-9). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#SORT_DIRECTION_DESCENDING() = 2` Items are sorted in descending order (e.g., Z-A, 9-0). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#SORT_DIRECTION_NONE() = 0` There is no sort direction. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#SORT_DIRECTION_OTHER() = 3` Items are sorted, but using a method other than ascending or descending (e.g., based on relevance or a custom algorithm). |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#getColumnIndex()()` Gets the column index at which the item is located. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#getColumnSpan()()` Gets the number of columns the item spans. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#getColumnTitle()()` Gets the column title at which the item is located. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#getRowIndex()()` Gets the row index at which the item is located. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#getRowSpan()()` Gets the number of rows the item spans. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#getRowTitle()()` Gets the row title at which the item is located. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#getSortDirection()()` Gets the sort direction applied to the data associated with this node. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `[isHeading](https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#isHeading())()` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat#isHeading()` <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#isSelected()()` Gets if the collection item is selected. |
| `java-static https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat!` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#obtain(int,int,int,int,boolean)( rowIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, rowSpan: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, columnIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, columnSpan: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, heading: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Returns a cached instance if such is available otherwise a new one. |
| `java-static https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat!` | `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#obtain(int,int,int,int,boolean,boolean)( rowIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, rowSpan: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, columnIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, columnSpan: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, heading: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, selected: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Returns a cached instance if such is available otherwise a new one. |

## Constants

### SORT_DIRECTION_ASCENDING

Added in [1.18.0-rc01](https://developer.android.com/jetpack/androidx/releases/core#1.18.0-rc01)

```
const val SORT_DIRECTION_ASCENDING = 1: Int
```

Items are sorted in ascending order (e.g., A-Z, 0-9).

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#getSortDirection()` |   |
| `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat.Builder#setSortDirection(int)` |   |

### SORT_DIRECTION_DESCENDING

Added in [1.18.0-rc01](https://developer.android.com/jetpack/androidx/releases/core#1.18.0-rc01)

```
const val SORT_DIRECTION_DESCENDING = 2: Int
```

Items are sorted in descending order (e.g., Z-A, 9-0).

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#getSortDirection()` |   |
| `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat.Builder#setSortDirection(int)` |   |

### SORT_DIRECTION_NONE

Added in [1.18.0-rc01](https://developer.android.com/jetpack/androidx/releases/core#1.18.0-rc01)

```
const val SORT_DIRECTION_NONE = 0: Int
```

There is no sort direction.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#getSortDirection()` |   |
| `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat.Builder#setSortDirection(int)` |   |

### SORT_DIRECTION_OTHER

Added in [1.18.0-rc01](https://developer.android.com/jetpack/androidx/releases/core#1.18.0-rc01)

```
const val SORT_DIRECTION_OTHER = 3: Int
```

Items are sorted, but using a method other than ascending or descending (e.g., based on relevance or a custom algorithm).

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#getSortDirection()` |   |
| `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat.Builder#setSortDirection(int)` |   |

## Public functions

### getColumnIndex

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun getColumnIndex(): Int
```

Gets the column index at which the item is located.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The column index. |

### getColumnSpan

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun getColumnSpan(): Int
```

Gets the number of columns the item spans.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The column span. |

### getColumnTitle

Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/core#1.12.0)

```
fun getColumnTitle(): String?
```

Gets the column title at which the item is located.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | The column title. |

### getRowIndex

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun getRowIndex(): Int
```

Gets the row index at which the item is located.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The row index. |

### getRowSpan

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun getRowSpan(): Int
```

Gets the number of rows the item spans.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The row span. |

### getRowTitle

Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/core#1.12.0)

```
fun getRowTitle(): String?
```

Gets the row title at which the item is located.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | The row title. |

### getSortDirection

Added in [1.18.0-rc01](https://developer.android.com/jetpack/androidx/releases/core#1.18.0-rc01)

```
fun getSortDirection(): Int
```

Gets the sort direction applied to the data associated with this node.

This item can only be set on a heading node within a table collection. Given the heading node's collection item, a subsequent collection item uses this sort direction if it has the same row or column index, and a greater index in the other dimension. For example, an item at row 2, column 2 can reference a heading at row 2, column 1 for its sort direction.

Compatibility:

- API \<36.1: Always returns SORT_DIRECTION_NONE

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The current sort direction. |

### isHeading

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun [isHeading](https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat#isHeading())(): Boolean
```
| **This function is deprecated.**   
|
| Use `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat#isHeading()`

Gets if the collection item is a heading. For example, section heading, table header, etc.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | If the item is a heading. |

### isSelected

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun isSelected(): Boolean
```

Gets if the collection item is selected.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | If the item is selected. |

### obtain

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
java-static fun obtain(
    rowIndex: Int,
    rowSpan: Int,
    columnIndex: Int,
    columnSpan: Int,
    heading: Boolean
): AccessibilityNodeInfoCompat.CollectionItemInfoCompat!
```

Returns a cached instance if such is available otherwise a new one.

| Parameters |
|---|---|
| `rowIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The row index at which the item is located. |
| `rowSpan: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of rows the item spans. |
| `columnIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The column index at which the item is located. |
| `columnSpan: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of columns the item spans. |
| `heading: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the item is a heading. This should be set to false and the newer `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat#setHeading(boolean)` used to identify headings. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat!` | An instance. |

### obtain

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
java-static fun obtain(
    rowIndex: Int,
    rowSpan: Int,
    columnIndex: Int,
    columnSpan: Int,
    heading: Boolean,
    selected: Boolean
): AccessibilityNodeInfoCompat.CollectionItemInfoCompat!
```

Returns a cached instance if such is available otherwise a new one.

| Parameters |
|---|---|
| `rowIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The row index at which the item is located. |
| `rowSpan: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of rows the item spans. |
| `columnIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The column index at which the item is located. |
| `columnSpan: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of columns the item spans. |
| `heading: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the item is a heading. This should be set to false and the newer `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat#setHeading(boolean)` used to identify headings. |
| `selected: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the item is selected. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat!` | An instance. |