# UiCollection

Summary: [Inherited Constants](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#inhconstants) \| [Ctors](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#pubctors) \| [Methods](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#inhmethods) \| [\[Expand All\]](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#)  

# UiCollection

| This package is part of the Android [support library](https://developer.android.com/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](https://developer.android.com/jetpack/androidx) which is part of [Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](https://developer.android.com/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class
| mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).


`
public


class
UiCollection
`


`


`

`

extends `[UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject)`


`

`


`

|---|---|-----------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [android.support.test.uiautomator.UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject) ||
|   | ↳ | android.support.test.uiautomator.UiCollection |

|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#)Known Direct Subclasses [UiScrollable](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable) |-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [UiScrollable](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable) | UiScrollable is a [UiCollection](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection) and provides support for searching for items in scrollable layout elements. | |

<br />

*** ** * ** ***

Used to enumerate a container's UI elements for the purpose of counting,
or targeting a sub elements by a child's text or description.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#)From class ` `[android.support.test.uiautomator.UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject)` ` |--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int`  | [FINGER_TOUCH_HALF_WIDTH](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#FINGER_TOUCH_HALF_WIDTH)                                                                                                                                                                                                   | | `int`  | [SWIPE_MARGIN_LIMIT](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#SWIPE_MARGIN_LIMIT)                                                                                                                                                                                                             | | `long` | [WAIT_FOR_EVENT_TMEOUT](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#WAIT_FOR_EVENT_TMEOUT) *This constant is deprecated. use [setScrollAcknowledgmentTimeout(long)](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setScrollAcknowledgmentTimeout(long))* | | `long` | [WAIT_FOR_SELECTOR_POLL](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#WAIT_FOR_SELECTOR_POLL)                                                                                                                                                                                                     | | `long` | [WAIT_FOR_SELECTOR_TIMEOUT](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#WAIT_FOR_SELECTOR_TIMEOUT) *This constant is deprecated. use [setWaitForSelectorTimeout(long)](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setWaitForSelectorTimeout(long))*   | | `long` | [WAIT_FOR_WINDOW_TMEOUT](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#WAIT_FOR_WINDOW_TMEOUT)                                                                                                                                                                                                     | |

|                                                                                                                                                          ### Public constructors                                                                                                                                                           ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[UiCollection](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#UiCollection(android.support.test.uiautomator.UiSelector))`(`[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)` selector) ` Constructs an instance as described by the selector |

|                                                                                                                                                                                                                                                                                                                                         ### Public methods                                                                                                                                                                                                                                                                                                                                          ||
|--------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject) | ` `[getChildByDescription](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#getChildByDescription(android.support.test.uiautomator.UiSelector, java.lang.String))`(`[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)` childPattern, `[String](https://developer.android.com/reference/java/lang/String.html)` text) ` Searches for child UI element within the constraints of this UiCollection [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector) selector. |
| ` `[UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject) | ` `[getChildByInstance](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#getChildByInstance(android.support.test.uiautomator.UiSelector, int))`(`[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)` childPattern, int instance) ` Searches for child UI element within the constraints of this UiCollection [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector) selector.                                                                                      |
| ` `[UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject) | ` `[getChildByText](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#getChildByText(android.support.test.uiautomator.UiSelector, java.lang.String))`(`[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)` childPattern, `[String](https://developer.android.com/reference/java/lang/String.html)` text) ` Searches for child UI element within the constraints of this UiCollection [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector) selector.               |
| ` int`                                                                                           | ` `[getChildCount](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#getChildCount(android.support.test.uiautomator.UiSelector))`(`[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)` childPattern) ` Counts child UI element instances matching the `childPattern` argument.                                                                                                                                                                                                                                 |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#)From class ` `[android.support.test.uiautomator.UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject)` ` |---------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` void`                                                                                                                   | ` `[clearTextField](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#clearTextField())`() ` Clears the existing text contents in an editable field.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` boolean`                                                                                                                | ` `[click](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#click())`() ` Performs a click at the center of the visible bounds of the UI element represented by this UiObject.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | ` boolean`                                                                                                                | ` `[clickAndWaitForNewWindow](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#clickAndWaitForNewWindow())`() ` Waits for window transitions that would typically take longer than the usual default timeouts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | ` boolean`                                                                                                                | ` `[clickAndWaitForNewWindow](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#clickAndWaitForNewWindow(long))`(long timeout) ` Performs a click at the center of the visible bounds of the UI element represented by this UiObject and waits for window transitions.                                                                                                                                                                                                                                                                                                                                                                                                              | | ` boolean`                                                                                                                | ` `[clickBottomRight](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#clickBottomRight())`() ` Clicks the bottom and right corner of the UI element                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` boolean`                                                                                                                | ` `[clickTopLeft](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#clickTopLeft())`() ` Clicks the top and left corner of the UI element                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ` boolean`                                                                                                                | ` `[dragTo](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#dragTo(android.support.test.uiautomator.UiObject, int))`(`[UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject)` destObj, int steps) ` Drags this object to a destination UiObject.                                                                                                                                                                                                                                                                                                                                                                                           | | ` boolean`                                                                                                                | ` `[dragTo](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#dragTo(int, int, int))`(int destX, int destY, int steps) ` Drags this object to arbitrary coordinates.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` boolean`                                                                                                                | ` `[exists](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#exists())`() ` Check if view exists.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` `[AccessibilityNodeInfo](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html) | ` `[findAccessibilityNodeInfo](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#findAccessibilityNodeInfo(long))`(long timeout) ` Finds a matching UI element in the accessibility hierarchy, by using the selector for this UiObject.                                                                                                                                                                                                                                                                                                                                                                                                                                             | | ` `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)                                             | ` `[getBounds](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getBounds())`() ` Returns the view's `bounds` property.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` `[UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject)                          | ` `[getChild](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getChild(android.support.test.uiautomator.UiSelector))`(`[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)` selector) ` Creates a new UiObject for a child view that is under the present UiObject.                                                                                                                                                                                                                                                                                                                                                                 | | ` int`                                                                                                                    | ` `[getChildCount](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getChildCount())`() ` Counts the child views immediately under the present UiObject.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ` `[String](https://developer.android.com/reference/java/lang/String.html)                                                | ` `[getClassName](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getClassName())`() ` Retrieves the `className` property of the UI element.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` `[String](https://developer.android.com/reference/java/lang/String.html)                                                | ` `[getContentDescription](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getContentDescription())`() ` Reads the `content_desc` property of the UI element                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` `[UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject)                          | ` `[getFromParent](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getFromParent(android.support.test.uiautomator.UiSelector))`(`[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)` selector) ` Creates a new UiObject for a sibling view or a child of the sibling view, relative to the present UiObject.                                                                                                                                                                                                                                                                                                                       | | ` `[String](https://developer.android.com/reference/java/lang/String.html)                                                | ` `[getPackageName](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getPackageName())`() ` Reads the view's `package` property                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` final `[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)                | ` `[getSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getSelector())`() ` Debugging helper.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)                                                | ` `[getText](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getText())`() ` Reads the `text` property of the UI element                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | ` `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)                                             | ` `[getVisibleBounds](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getVisibleBounds())`() ` Returns the visible bounds of the view.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` boolean`                                                                                                                | ` `[isCheckable](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#isCheckable())`() ` Checks if the UI element's `checkable` property is currently true.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ` boolean`                                                                                                                | ` `[isChecked](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#isChecked())`() ` Check if the UI element's `checked` property is currently true                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` boolean`                                                                                                                | ` `[isClickable](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#isClickable())`() ` Checks if the UI element's `clickable` property is currently true.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ` boolean`                                                                                                                | ` `[isEnabled](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#isEnabled())`() ` Checks if the UI element's `enabled` property is currently true.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` boolean`                                                                                                                | ` `[isFocusable](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#isFocusable())`() ` Check if the UI element's `focusable` property is currently true.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` boolean`                                                                                                                | ` `[isFocused](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#isFocused())`() ` Check if the UI element's `focused` property is currently true                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` boolean`                                                                                                                | ` `[isLongClickable](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#isLongClickable())`() ` Check if the view's `long-clickable` property is currently true                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` boolean`                                                                                                                | ` `[isScrollable](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#isScrollable())`() ` Check if the view's `scrollable` property is currently true                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` boolean`                                                                                                                | ` `[isSelected](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#isSelected())`() ` Checks if the UI element's `selected` property is currently true.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` boolean`                                                                                                                | ` `[longClick](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#longClick())`() ` Long clicks the center of the visible bounds of the UI element                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` boolean`                                                                                                                | ` `[longClickBottomRight](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#longClickBottomRight())`() ` Long clicks bottom and right corner of the UI element                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` boolean`                                                                                                                | ` `[longClickTopLeft](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#longClickTopLeft())`() ` Long clicks on the top and left corner of the UI element                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ` boolean`                                                                                                                | ` `[performMultiPointerGesture](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#performMultiPointerGesture(android.view.MotionEvent.PointerCoords[]...))`(`[PointerCoords...](https://developer.android.com/reference/android/view/MotionEvent.PointerCoords.html)` touches) ` Performs a multi-touch gesture.                                                                                                                                                                                                                                                                                                                                                                    | | ` boolean`                                                                                                                | ` `[performTwoPointerGesture](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#performTwoPointerGesture(android.graphics.Point, android.graphics.Point, android.graphics.Point, android.graphics.Point, int))`(`[Point](https://developer.android.com/reference/android/graphics/Point.html)` startPoint1, `[Point](https://developer.android.com/reference/android/graphics/Point.html)` startPoint2, `[Point](https://developer.android.com/reference/android/graphics/Point.html)` endPoint1, `[Point](https://developer.android.com/reference/android/graphics/Point.html)` endPoint2, int steps) ` Generates a two-pointer gesture with arbitrary starting and ending points. | | ` boolean`                                                                                                                | ` `[pinchIn](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#pinchIn(int, int))`(int percent, int steps) ` Performs a two-pointer gesture, where each pointer moves diagonally toward the other, from the edges to the center of this UiObject .                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` boolean`                                                                                                                | ` `[pinchOut](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#pinchOut(int, int))`(int percent, int steps) ` Performs a two-pointer gesture, where each pointer moves diagonally opposite across the other, from the center out towards the edges of the this UiObject.                                                                                                                                                                                                                                                                                                                                                                                                           | | ` boolean`                                                                                                                | ` `[setText](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#setText(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` text) ` Sets the text in an editable field, after clearing the field's content.                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` boolean`                                                                                                                | ` `[swipeDown](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#swipeDown(int))`(int steps) ` Performs the swipe down action on the UiObject.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` boolean`                                                                                                                | ` `[swipeLeft](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#swipeLeft(int))`(int steps) ` Performs the swipe left action on the UiObject.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` boolean`                                                                                                                | ` `[swipeRight](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#swipeRight(int))`(int steps) ` Performs the swipe right action on the UiObject.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` boolean`                                                                                                                | ` `[swipeUp](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#swipeUp(int))`(int steps) ` Performs the swipe up action on the UiObject.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` boolean`                                                                                                                | ` `[waitForExists](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#waitForExists(long))`(long timeout) ` Waits a specified length of time for a view to become visible.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ` boolean`                                                                                                                | ` `[waitUntilGone](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#waitUntilGone(long))`(long timeout) ` Waits a specified length of time for a view to become undetectable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection#)From class ` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)` ` |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                                | | ` boolean`                                                                          | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                             | ` finalize() `                                                                             | | ` final `[Class](https://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                             | | ` int`                                                                              | ` hashCode() `                                                                             | | ` final void`                                                                       | ` notify() `                                                                               | | ` final void`                                                                       | ` notifyAll() `                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                             | | ` final void`                                                                       | ` wait(long arg0, int arg1) `                                                              | | ` final void`                                                                       | ` wait(long arg0) `                                                                        | | ` final void`                                                                       | ` wait() `                                                                                 | ||

## Public constructors

### UiCollection

```
UiCollection (UiSelector selector)
```

Constructs an instance as described by the selector

<br />

## Public methods

### getChildByDescription

```
UiObject getChildByDescription (UiSelector childPattern, 
                String text)
```

Searches for child UI element within the constraints of this UiCollection [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)
selector.

It looks for any child matching the `childPattern` argument that has
a child UI element anywhere within its sub hierarchy that has content-description text.
The returned UiObject will point at the `childPattern` instance that matched the
search and not at the identifying child element that matched the content description.

<br />

<br />

|                                                                                        Parameters                                                                                        ||
|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `childPattern` | `UiSelector`: [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector) selector of the child pattern to match and return <br /> |
| `text`         | `String`: String of the identifying child contents of of the `childPattern` <br />                                                                                       |

|                                                                                                                    Returns                                                                                                                     ||
|-----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| [UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject) | [UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject) pointing at and instance of `childPattern` <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### getChildByInstance

```
UiObject getChildByInstance (UiSelector childPattern, 
                int instance)
```

Searches for child UI element within the constraints of this UiCollection [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)
selector.

It looks for any child matching the `childPattern` argument that has
a child UI element anywhere within its sub hierarchy that is at the `instance`
specified. The operation is performed only on the visible items and no scrolling is performed
in this case.

<br />

|                                                                                        Parameters                                                                                        ||
|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `childPattern` | `UiSelector`: [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector) selector of the child pattern to match and return <br /> |
| `instance`     | `int`: int the desired matched instance of this `childPattern` <br />                                                                                                    |

|                                                                                                                    Returns                                                                                                                     ||
|-----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| [UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject) | [UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject) pointing at and instance of `childPattern` <br /> |

|                                                               Throws                                                               ||
|---------------------------------------------------------------------------------------------------------------------------------|---|
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |   |

### getChildByText

```
UiObject getChildByText (UiSelector childPattern, 
                String text)
```

Searches for child UI element within the constraints of this UiCollection [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)
selector.

It looks for any child matching the `childPattern` argument that has
a child UI element anywhere within its sub hierarchy that has text attribute =
`text`. The returned UiObject will point at the `childPattern`
instance that matched the search and not at the identifying child element that matched the
text attribute.

<br />

<br />

|                                                                                        Parameters                                                                                        ||
|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `childPattern` | `UiSelector`: [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector) selector of the child pattern to match and return <br /> |
| `text`         | `String`: String of the identifying child contents of of the `childPattern` <br />                                                                                       |

|                                                                                                                    Returns                                                                                                                     ||
|-----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| [UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject) | [UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject) pointing at and instance of `childPattern` <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### getChildCount

```
int getChildCount (UiSelector childPattern)
```

Counts child UI element instances matching the `childPattern`
argument. The method returns the number of matching UI elements that are
currently visible. The count does not include items of a scrollable list
that are off-screen.

<br />

|                                                                                            Parameters                                                                                            ||
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `childPattern` | `UiSelector`: a [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector) that represents the matching child UI elements to count <br /> |

|                                                                                 Returns                                                                                  ||
|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | the number of matched childPattern under the current [UiCollection](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection) <br /> |

-

  ## Interfaces

  - [IAutomationSupport](https://developer.android.com/reference/android/support/test/uiautomator/IAutomationSupport)
  - [UiWatcher](https://developer.android.com/reference/android/support/test/uiautomator/UiWatcher)
-

  ## Classes

  - [By](https://developer.android.com/reference/android/support/test/uiautomator/By)
  - [BySelector](https://developer.android.com/reference/android/support/test/uiautomator/BySelector)
  - [Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator)
  - [EventCondition](https://developer.android.com/reference/android/support/test/uiautomator/EventCondition)
  - [SearchCondition](https://developer.android.com/reference/android/support/test/uiautomator/SearchCondition)
  - [UiAutomatorInstrumentationTestRunner](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorInstrumentationTestRunner)
  - [UiAutomatorTestCase](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorTestCase)
  - [UiCollection](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection)
  - [UiDevice](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice)
  - [UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject)
  - [UiObject2](https://developer.android.com/reference/android/support/test/uiautomator/UiObject2)
  - [UiObject2Condition](https://developer.android.com/reference/android/support/test/uiautomator/UiObject2Condition)
  - [UiScrollable](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable)
  - [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)
  - [Until](https://developer.android.com/reference/android/support/test/uiautomator/Until)
-

  ## Enums

  - [Direction](https://developer.android.com/reference/android/support/test/uiautomator/Direction)
-

  ## Exceptions

  - [StaleObjectException](https://developer.android.com/reference/android/support/test/uiautomator/StaleObjectException)
  - [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException)