robotium

Lifecycle Testing with Robotium: Killing and Restarting Activity

笑着哭i 提交于 2019-11-27 07:17:48
问题 How is it possible to restart an activity that was ended using Robotium's solo.goBack() ? The following does not restart the activity: (the test finishes ok) solo.goBack(); try { // recreate activity here runTestOnUiThread(new Runnable() { public void run() { getInstrumentation().callActivityOnCreate(getActivity(), null); getInstrumentation().callActivityOnStart(getActivity()); getInstrumentation().callActivityOnResume(getActivity()); }}); } How do you restart an Activity that was ended by