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.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# ActivityResultMatchers\n\nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \\| [\\[Expand All\\]](#) \n\nActivityResultMatchers\n======================\n\n| This package is part of the Android [support library](/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class\n| mappings](/jetpack/androidx/migrate/class-mappings).\n\n\n`\npublic\n\nfinal\n\nclass\nActivityResultMatchers\n`\n\n\n`\n\nextends `[Object](https://developer.android.com/reference/java/lang/Object.html)`\n\n\n`\n\n`\n\n\n`\n\n|---|--------------------------------------------------------------|\n| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||\n| ↳ | android.support.test.espresso.contrib.ActivityResultMatchers |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nHamcrest matchers for a [Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html).\n\nSummary\n-------\n\n| ### Public methods ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` static Matcher\u003c? super `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html)`\u003e` | ` `[hasResultCode](/reference/android/support/test/espresso/contrib/ActivityResultMatchers#hasResultCode(int))`(int resultCode) ` Returns a matcher that verifies that the `resultCode` of a given [Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) matches the given code |\n| ` static Matcher\u003c? super `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html)`\u003e` | ` `[hasResultData](/reference/android/support/test/espresso/contrib/ActivityResultMatchers#hasResultData(org.hamcrest.Matcher\u003candroid.content.Intent\u003e))`(Matcher\u003c`[Intent](https://developer.android.com/reference/android/content/Intent.html)`\u003e intentMatcher) ` Returns a matcher that verifies that the resultData of a given [Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) matches the given specification by the `intentMatcher` |\n\n| ### Inherited methods |\n|-----------------------|---|\n| 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)`\u003c?\u003e` | ` 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() ` | ||\n\nPublic methods\n--------------\n\n### hasResultCode\n\n```\nMatcher\u003c? super Instrumentation.ActivityResult\u003e hasResultCode (int resultCode)\n```\n\nReturns a matcher that verifies that the `resultCode` of a given [Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html)\nmatches the given code\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------------|--------------|\n| `resultCode` | `int` \u003cbr /\u003e |\n\n| Returns ||\n|------------------------------------------------------------------------------------------------------------------------------------------------|--------|\n| `Matcher\u003c? super `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html)`\u003e` | \u003cbr /\u003e |\n\n### hasResultData\n\n```\nMatcher\u003c? super Instrumentation.ActivityResult\u003e hasResultData (Matcher\u003cIntent\u003e intentMatcher)\n```\n\nReturns a matcher that verifies that the resultData of a given [Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) matches\nthe given specification by the `intentMatcher`\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------------|------------------|\n| `intentMatcher` | `Matcher` \u003cbr /\u003e |\n\n| Returns ||\n|------------------------------------------------------------------------------------------------------------------------------------------------|--------|\n| `Matcher\u003c? super `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html)`\u003e` | \u003cbr /\u003e |\n\n-\n\n Interfaces\n ----------\n\n - [RecyclerViewActions.PositionableRecyclerViewAction](/reference/android/support/test/espresso/contrib/RecyclerViewActions.PositionableRecyclerViewAction)\n-\n\n Classes\n -------\n\n - [AccessibilityChecks](/reference/android/support/test/espresso/contrib/AccessibilityChecks)\n - [ActivityResultMatchers](/reference/android/support/test/espresso/contrib/ActivityResultMatchers)\n - [DrawerActions](/reference/android/support/test/espresso/contrib/DrawerActions)\n - [DrawerMatchers](/reference/android/support/test/espresso/contrib/DrawerMatchers)\n - [NavigationViewActions](/reference/android/support/test/espresso/contrib/NavigationViewActions)\n - [PickerActions](/reference/android/support/test/espresso/contrib/PickerActions)\n - [RecyclerViewActions](/reference/android/support/test/espresso/contrib/RecyclerViewActions)\n - [ViewPagerActions](/reference/android/support/test/espresso/contrib/ViewPagerActions)"]]