AccessibilityNodeInfo.CollectionItemInfo
public
static
final
class
AccessibilityNodeInfo.CollectionItemInfo
extends Object
java.lang.Object | |
↳ | android.view.accessibility.AccessibilityNodeInfo.CollectionItemInfo |
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 classes | |
---|---|
class |
AccessibilityNodeInfo.CollectionItemInfo.Builder
Builder for creating |
Constants | |
---|---|
int |
SORT_DIRECTION_ASCENDING
Items are sorted in ascending order (e.g., A-Z, 0-9). |
int |
SORT_DIRECTION_DESCENDING
Items are sorted in descending order (e.g., Z-A, 9-0). |
int |
SORT_DIRECTION_NONE
There is no sort direction. |
int |
SORT_DIRECTION_OTHER
Items are sorted, but using a method other than ascending or descending (e.g., based on relevance or a custom algorithm). |
Public constructors | |
---|---|
CollectionItemInfo(int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading)
Creates a new instance. |
|
CollectionItemInfo(int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading, boolean selected)
Creates a new instance. |
Public methods | |
---|---|
int
|
getColumnIndex()
Gets the column index at which the item is located. |
int
|
getColumnSpan()
Gets the number of columns the item spans. |
String
|
getColumnTitle()
Gets the column title at which the item is located. |
int
|
getRowIndex()
Gets the row index at which the item is located. |
int
|
getRowSpan()
Gets the number of rows the item spans. |
String
|
getRowTitle()
Gets the row title at which the item is located. |
int
|
getSortDirection()
Gets the sort direction applied to the data associated with this node. |
boolean
|
isHeading()
This method was deprecated
in API level 28.
Use |
boolean
|
isSelected()
Gets if the collection item is selected. |
static
AccessibilityNodeInfo.CollectionItemInfo
|
obtain(int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading)
This method was deprecated
in API level 33.
Object pooling has been discontinued. Create a new instance using the
constructor |
static
AccessibilityNodeInfo.CollectionItemInfo
|
obtain(int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading, boolean selected)
This method was deprecated
in API level 33.
Object pooling has been discontinued. Create a new instance using the
constructor |
Inherited methods | |
---|---|
Constants
SORT_DIRECTION_ASCENDING
public static final int SORT_DIRECTION_ASCENDING
Items are sorted in ascending order (e.g., A-Z, 0-9).
Constant Value: 1 (0x00000001)
SORT_DIRECTION_DESCENDING
public static final int SORT_DIRECTION_DESCENDING
Items are sorted in descending order (e.g., Z-A, 9-0).
Constant Value: 2 (0x00000002)
SORT_DIRECTION_NONE
public static final int SORT_DIRECTION_NONE
There is no sort direction.
Constant Value: 0 (0x00000000)
SORT_DIRECTION_OTHER
public static final int SORT_DIRECTION_OTHER
Items are sorted, but using a method other than ascending or descending (e.g., based on relevance or a custom algorithm).
Constant Value: 3 (0x00000003)
Public constructors
CollectionItemInfo
public CollectionItemInfo (int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading)
Creates a new instance.
Parameters | |
---|---|
rowIndex |
int : The row index at which the item is located. |
rowSpan |
int : The number of rows the item spans. |
columnIndex |
int : The column index at which the item is located. |
columnSpan |
int : The number of columns the item spans. |
heading |
boolean : Whether the item is a heading. |
CollectionItemInfo
public CollectionItemInfo (int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading, boolean selected)
Creates a new instance.
Parameters | |
---|---|
rowIndex |
int : The row index at which the item is located. |
rowSpan |
int : The number of rows the item spans. |
columnIndex |
int : The column index at which the item is located. |
columnSpan |
int : The number of columns the item spans. |
heading |
boolean : Whether the item is a heading. |
selected |
boolean : Whether the item is selected. |
Public methods
getColumnIndex
public int getColumnIndex ()
Gets the column index at which the item is located.
Returns | |
---|---|
int |
The column index. |
getColumnSpan
public int getColumnSpan ()
Gets the number of columns the item spans.
Returns | |
---|---|
int |
The column span. |
getColumnTitle
public String getColumnTitle ()
Gets the column title at which the item is located.
Returns | |
---|---|
String |
The column title.
This value may be null . |
getRowIndex
public int getRowIndex ()
Gets the row index at which the item is located.
Returns | |
---|---|
int |
The row index. |
getRowSpan
public int getRowSpan ()
Gets the number of rows the item spans.
Returns | |
---|---|
int |
The row span. |
getRowTitle
public String getRowTitle ()
Gets the row title at which the item is located.
Returns | |
---|---|
String |
The row title.
This value may be null . |
getSortDirection
public int getSortDirection ()
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.
Returns | |
---|---|
int |
The current sort direction, one of:
Value is SORT_DIRECTION_NONE , SORT_DIRECTION_ASCENDING , SORT_DIRECTION_DESCENDING , or SORT_DIRECTION_OTHER |
isHeading
public boolean isHeading ()
This method was deprecated
in API level 28.
Use AccessibilityNodeInfo.isHeading()
Gets if the collection item is a heading. For example, section heading, table header, etc.
Returns | |
---|---|
boolean |
If the item is a heading. |
isSelected
public boolean isSelected ()
Gets if the collection item is selected.
Returns | |
---|---|
boolean |
If the item is selected. |
obtain
public static AccessibilityNodeInfo.CollectionItemInfo obtain (int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading)
This method was deprecated
in API level 33.
Object pooling has been discontinued. Create a new instance using the
constructor CollectionItemInfo(int, int, int, int, boolean)
instead.
Instantiates a new CollectionItemInfo.
Parameters | |
---|---|
rowIndex |
int : The row index at which the item is located. |
rowSpan |
int : The number of rows the item spans. |
columnIndex |
int : The column index at which the item is located. |
columnSpan |
int : The number of columns the item spans. |
heading |
boolean : Whether the item is a heading. (Prefer
AccessibilityNodeInfo.setHeading(boolean) ). |
Returns | |
---|---|
AccessibilityNodeInfo.CollectionItemInfo |
obtain
public static AccessibilityNodeInfo.CollectionItemInfo obtain (int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading, boolean selected)
This method was deprecated
in API level 33.
Object pooling has been discontinued. Create a new instance using the
constructor CollectionItemInfo(int, int, int, int, boolean)
instead.
Instantiates a new CollectionItemInfo.
Parameters | |
---|---|
rowIndex |
int : The row index at which the item is located. |
rowSpan |
int : The number of rows the item spans. |
columnIndex |
int : The column index at which the item is located. |
columnSpan |
int : The number of columns the item spans. |
heading |
boolean : Whether the item is a heading. (Prefer
AccessibilityNodeInfo.setHeading(boolean) ). |
selected |
boolean : Whether the item is selected. |
Returns | |
---|---|
AccessibilityNodeInfo.CollectionItemInfo |
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-08-20 UTC.