Last active
July 2, 2016 06:23
-
-
Save akihito104/e530894b9818e2438f38fe3197b6d51e to your computer and use it in GitHub Desktop.
android instrumentation test for home button interaction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent home = new Intent(); | |
home.setAction(Intent.ACTION_MAIN); | |
home.addCategory(Intent.CATEGORY_HOME); | |
home.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
Intent relaunch = new Intent(rule.getActivity(), rule.getActivity().getClass()); | |
relaunch.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); | |
InstrumentationRegistry.getTargetContext().startActivity(home); | |
Thread.sleep(500); // XXX | |
rule.getActivity().startActivity(relaunch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment