A sneaky singleton object used to respond to intents with fake responses. This interface is not
meant for public consumption. Test authors should use Intents instead.
Sets the result that will be returned to the intent sender (if the sender expects the result),
next time an intent matched by the given matcher is launched.
Sets a result function that will be called by the intent sender (if the sender expects the
result), next time an intent matched by the given matcher is launched.
Sets the result that will be returned to the intent sender (if the sender expects the result),
next time an intent matched by the given matcher is launched.
Sets a result function that will be called by the intent sender (if the sender expects the
result), next time an intent matched by the given matcher is launched.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ResettingStubber\n\nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \\| [\\[Expand All\\]](#) \n\nResettingStubber\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\n\ninterface\nResettingStubber\n`\n\n\n`\n\n\nimplements\n\n`[IntentStubber](/reference/android/support/test/runner/intent/IntentStubber)`\n\n\n`\n\n|-------------------------------------------------------|\n| android.support.test.espresso.intent.ResettingStubber |\n\n|---|---|\n| Known Indirect Subclasses [ResettingStubberImpl](/reference/android/support/test/espresso/intent/ResettingStubberImpl) |----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| | [ResettingStubberImpl](/reference/android/support/test/espresso/intent/ResettingStubberImpl) | Implementation of [ResettingStubber](/reference/android/support/test/espresso/intent/ResettingStubber) | ||\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA sneaky singleton object used to respond to intents with fake responses. This interface is not\nmeant for public consumption. Test authors should use [Intents](/reference/android/support/test/espresso/intent/Intents) instead.\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[initialize](/reference/android/support/test/espresso/intent/ResettingStubber#initialize())`() ` Marks this spy as initialized. |\n| ` abstract boolean` | ` `[isInitialized](/reference/android/support/test/espresso/intent/ResettingStubber#isInitialized())`() ` |\n| ` abstract void` | ` `[reset](/reference/android/support/test/espresso/intent/ResettingStubber#reset())`() ` Clears state (initialization, expected responses). |\n| ` abstract void` | ` `[setActivityResultForIntent](/reference/android/support/test/espresso/intent/ResettingStubber#setActivityResultForIntent(org.hamcrest.Matcher\u003candroid.content.Intent\u003e, android.app.Instrumentation.ActivityResult))`(Matcher\u003c`[Intent](https://developer.android.com/reference/android/content/Intent.html)`\u003e matcher, `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html)` result) ` Sets the result that will be returned to the intent sender (if the sender expects the result), next time an intent matched by the given matcher is launched. |\n| ` abstract void` | ` `[setActivityResultFunctionForIntent](/reference/android/support/test/espresso/intent/ResettingStubber#setActivityResultFunctionForIntent(org.hamcrest.Matcher\u003candroid.content.Intent\u003e, android.support.test.espresso.intent.ActivityResultFunction))`(Matcher\u003c`[Intent](https://developer.android.com/reference/android/content/Intent.html)`\u003e matcher, `[ActivityResultFunction](/reference/android/support/test/espresso/intent/ActivityResultFunction)` result) ` Sets a result function that will be called by the intent sender (if the sender expects the result), next time an intent matched by the given matcher is launched. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[android.support.test.runner.intent.IntentStubber](/reference/android/support/test/runner/intent/IntentStubber)` ` |---------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` `[getActivityResultForIntent](/reference/android/support/test/runner/intent/IntentStubber#getActivityResultForIntent(android.content.Intent))`(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent) ` Returns the first matching stubbed result for the given activity if stubbed result was set by test author. | ||\n\nPublic methods\n--------------\n\n### initialize\n\n```\nvoid initialize ()\n```\n\nMarks this spy as initialized. Once initialized, ResettingStubber begins recording intents and\nprovides intent stubbing.\n\n\u003cbr /\u003e\n\n### isInitialized\n\n```\nboolean isInitialized ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------|------------------------------------------|\n| `boolean` | `true` if this spy is initialized \u003cbr /\u003e |\n\n### reset\n\n```\nvoid reset ()\n```\n\nClears state (initialization, expected responses).\n\nMust be called on main thread.\n\n\u003cbr /\u003e\n\n### setActivityResultForIntent\n\n```\nvoid setActivityResultForIntent (Matcher\u003cIntent\u003e matcher, \n Instrumentation.ActivityResult result)\n```\n\nSets the result that will be returned to the intent sender (if the sender expects the result),\nnext time an intent matched by the given matcher is launched.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|-----------------------------------------|\n| `matcher` | `Matcher` \u003cbr /\u003e |\n| `result` | `Instrumentation.ActivityResult` \u003cbr /\u003e |\n\n### setActivityResultFunctionForIntent\n\n```\nvoid setActivityResultFunctionForIntent (Matcher\u003cIntent\u003e matcher, \n ActivityResultFunction result)\n```\n\nSets a result function that will be called by the intent sender (if the sender expects the\nresult), next time an intent matched by the given matcher is launched.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|---------------------------------|\n| `matcher` | `Matcher` \u003cbr /\u003e |\n| `result` | `ActivityResultFunction` \u003cbr /\u003e |\n\n-\n\n Interfaces\n ----------\n\n - [ActivityResultFunction](/reference/android/support/test/espresso/intent/ActivityResultFunction)\n - [ResettingStubber](/reference/android/support/test/espresso/intent/ResettingStubber)\n - [ResolvedIntent](/reference/android/support/test/espresso/intent/ResolvedIntent)\n - [VerifiableIntent](/reference/android/support/test/espresso/intent/VerifiableIntent)\n - [VerificationMode](/reference/android/support/test/espresso/intent/VerificationMode)\n-\n\n Classes\n -------\n\n - [Checks](/reference/android/support/test/espresso/intent/Checks)\n - [Intents](/reference/android/support/test/espresso/intent/Intents)\n - [OngoingStubbing](/reference/android/support/test/espresso/intent/OngoingStubbing)\n - [ResettingStubberImpl](/reference/android/support/test/espresso/intent/ResettingStubberImpl)\n - [VerificationModes](/reference/android/support/test/espresso/intent/VerificationModes)"]]