private void backToTest() { /*Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName(mContext.getPackageName(), AutoTestActivity.class.getName()); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); mContext.startActivity(intent);*/ Instrumentation inst = new Instrumentation(); inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK); inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK); }
// helper functions private void press(int keycode) { mInst.sendKeyDownUpSync(keycode); }