# StaleObjectException

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

# StaleObjectException

| 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
StaleObjectException
`  
`


``


``


``

extends `[RuntimeException](https://developer.android.com/reference/java/lang/RuntimeException.html)`


``


`

|---|---|---|---|-------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||||
| ↳ | [java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable.html) ||||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception.html) |||
|   |   | ↳ | [java.lang.RuntimeException](https://developer.android.com/reference/java/lang/RuntimeException.html) ||
|   |   |   | ↳ | android.support.test.uiautomator.StaleObjectException |

<br />

*** ** * ** ***

A[StaleObjectException](https://developer.android.com/reference/android/support/test/uiautomator/StaleObjectException)exception is thrown when a[UiObject2](https://developer.android.com/reference/android/support/test/uiautomator/UiObject2)is used after the underlying[View](https://developer.android.com/reference/android/view/View.html)has been destroyed. In this case, it is necessary to call[findObject(BySelector)](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice#findObject(android.support.test.uiautomator.BySelector))to obtain a new[UiObject2](https://developer.android.com/reference/android/support/test/uiautomator/UiObject2)instance.

## Summary

|                                                                 ### Public constructors                                                                 ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[StaleObjectException](https://developer.android.com/reference/android/support/test/uiautomator/StaleObjectException#StaleObjectException())`() ` |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/StaleObjectException#)From class` `[java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable.html)` ` |----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------| | ` final void`                                                                                      | ` addSuppressed(`[Throwable](https://developer.android.com/reference/java/lang/Throwable.html)` arg0) `                   | | ` `[Throwable](https://developer.android.com/reference/java/lang/Throwable.html)                   | ` fillInStackTrace() `                                                                                                    | | ` `[Throwable](https://developer.android.com/reference/java/lang/Throwable.html)                   | ` getCause() `                                                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)                         | ` getLocalizedMessage() `                                                                                                 | | ` `[String](https://developer.android.com/reference/java/lang/String.html)                         | ` getMessage() `                                                                                                          | | ` `[StackTraceElement[]](https://developer.android.com/reference/java/lang/StackTraceElement.html) | ` getStackTrace() `                                                                                                       | | ` final `[Throwable[]](https://developer.android.com/reference/java/lang/Throwable.html)           | ` getSuppressed() `                                                                                                       | | ` `[Throwable](https://developer.android.com/reference/java/lang/Throwable.html)                   | ` initCause(`[Throwable](https://developer.android.com/reference/java/lang/Throwable.html)` arg0) `                       | | ` void`                                                                                            | ` printStackTrace() `                                                                                                     | | ` void`                                                                                            | ` printStackTrace(`[PrintWriter](https://developer.android.com/reference/java/io/PrintWriter.html)` arg0) `               | | ` void`                                                                                            | ` printStackTrace(`[PrintStream](https://developer.android.com/reference/java/io/PrintStream.html)` arg0) `               | | ` void`                                                                                            | ` setStackTrace(`[StackTraceElement[]](https://developer.android.com/reference/java/lang/StackTraceElement.html)` arg0) ` | | ` `[String](https://developer.android.com/reference/java/lang/String.html)                         | ` toString() `                                                                                                            | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/StaleObjectException#)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

### StaleObjectException

```
StaleObjectException ()
```

<br />

<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)