views:

918

answers:

2

Hello,

I'm currently running automation tests using an app that uses multiple Activity for displaying each screen.

Is there anyway to go back to a previously launched Activity while running an Instrumentation test? Currently, when I use sendKeyDownUpSync( KeyEvent.KEYCODE_BACK);, this forces my test to exit, rather than go back to the previous Activity.

Any help with this is greatly appreciated.

Jin

+2  A: 

You could try calling the finish() method on the Activity you wish to close.

Dave Webb
A: 

Cool. finish() works well :) Unless,of course, Android Runtime doesn't kill the previous activity to free resources.

Nikhil Patil