When using AppiumDriver.startActivity method, how to switch back to original app?

I’m using the java_client:

I first start my app, then I need to start a second app (in this case the facebook app) and log-out from the second app. I start the second app using the:
AndroidDriver.startActivity("com.facebook.katana", "LoginActivity", null, null).

After I have logged out from the second app, how to I return to my first app?


Try to do that using adb: http://stackoverflow.com/questions/7415997/how-to-start-and-stop-android-service-from-a-adb-shell

I called this method as a workaround:

AndroidDriver.runAppInBackground(1); // for 1 second

Does anyone found any solution for this…?