AccessibilityNodeInfo.CollectionInfo
  public
  static
  final
  
  class
  AccessibilityNodeInfo.CollectionInfo
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | 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 | |
|---|---|
| 
        
        
        
        
        class | AccessibilityNodeInfo.CollectionInfo.BuilderThe builder for CollectionInfo. | 
| Constants | |
|---|---|
| int | SELECTION_MODE_MULTIPLESelection mode where multiple items may be selected. | 
| int | SELECTION_MODE_NONESelection mode where items are not selectable. | 
| int | SELECTION_MODE_SINGLESelection mode where a single item may be selected. | 
| int | UNDEFINEDConstant to denote a missing collection count. | 
| Public constructors | |
|---|---|
| 
      CollectionInfo(int rowCount, int columnCount, boolean hierarchical)
      Creates a new instance. | |
| 
      CollectionInfo(int rowCount, int columnCount, boolean hierarchical, int selectionMode)
      Creates a new instance. | |
| Public methods | |
|---|---|
| 
        
        
        
        
        
        int | 
      getColumnCount()
      Gets the number of columns. | 
| 
        
        
        
        
        
        int | 
      getImportantForAccessibilityItemCount()
      Gets the number of items in the collection considered important for accessibility. | 
| 
        
        
        
        
        
        int | 
      getItemCount()
      Gets the number of items in the collection. | 
| 
        
        
        
        
        
        int | 
      getRowCount()
      Gets the number of rows. | 
| 
        
        
        
        
        
        int | 
      getSelectionMode()
      Gets the collection's selection mode. | 
| 
        
        
        
        
        
        boolean | 
      isHierarchical()
      Gets if the collection is a hierarchically ordered. | 
| 
        
        
        static
        
        
        AccessibilityNodeInfo.CollectionInfo | 
      obtain(int rowCount, int columnCount, boolean hierarchical, int selectionMode)
      
      This method was deprecated
      in API level 33.
    Object pooling has been discontinued. Create a new instance using the
 constructor  | 
| 
        
        
        static
        
        
        AccessibilityNodeInfo.CollectionInfo | 
      obtain(int rowCount, int columnCount, boolean hierarchical)
      
      This method was deprecated
      in API level 33.
    Object pooling has been discontinued. Create a new instance using the
 constructor  | 
| Inherited methods | |
|---|---|
Constants
SELECTION_MODE_MULTIPLE
public static final int SELECTION_MODE_MULTIPLE
Selection mode where multiple items may be selected.
Constant Value: 2 (0x00000002)
SELECTION_MODE_NONE
public static final int SELECTION_MODE_NONE
Selection mode where items are not selectable.
Constant Value: 0 (0x00000000)
SELECTION_MODE_SINGLE
public static final int SELECTION_MODE_SINGLE
Selection mode where a single item may be selected.
Constant Value: 1 (0x00000001)
UNDEFINED
public static final int UNDEFINED
Constant to denote a missing collection count.
 This should be used for mItemCount and
 mImportantForAccessibilityItemCount when values for those fields are not known.
Constant Value: -1 (0xffffffff)
Public constructors
CollectionInfo
public CollectionInfo (int rowCount, 
                int columnCount, 
                boolean hierarchical)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
public CollectionInfo (int rowCount, 
                int columnCount, 
                boolean hierarchical, 
                int selectionMode)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
public int getColumnCount ()
Gets the number of columns.
| Returns | |
|---|---|
| int | The column count, or -1 if count is unknown. | 
getImportantForAccessibilityItemCount
public int getImportantForAccessibilityItemCount ()
Gets the number of items in the collection considered important for accessibility.
| Returns | |
|---|---|
| int | The count of items important for accessibility, which may be UNDEFINEDif the count is not known. | 
getItemCount
public int getItemCount ()
Gets the number of items in the collection.
| Returns | |
|---|---|
| int | The count of items, which may be UNDEFINEDif the count is not known. | 
getRowCount
public int getRowCount ()
Gets the number of rows.
| Returns | |
|---|---|
| int | The row count, or -1 if count is unknown. | 
getSelectionMode
public int getSelectionMode ()
Gets the collection's selection mode.
| Returns | |
|---|---|
| int | The collection's selection mode, one of: | 
isHierarchical
public boolean isHierarchical ()
Gets if the collection is a hierarchically ordered.
| Returns | |
|---|---|
| boolean | Whether the collection is hierarchical. | 
obtain
public static AccessibilityNodeInfo.CollectionInfo obtain (int rowCount, int columnCount, boolean hierarchical, int selectionMode)
      This method was deprecated
      in API level 33.
    Object pooling has been discontinued. Create a new instance using the
 constructor 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: | 
| Returns | |
|---|---|
| AccessibilityNodeInfo.CollectionInfo | |
obtain
public static AccessibilityNodeInfo.CollectionInfo obtain (int rowCount, int columnCount, boolean hierarchical)
      This method was deprecated
      in API level 33.
    Object pooling has been discontinued. Create a new instance using the
 constructor 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. | 
| Returns | |
|---|---|
| AccessibilityNodeInfo.CollectionInfo | |
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.
