title: Android : Avoid app to quit after automation testing
body: <p>I am writing android automation test using Robotium and after successful test, I want to take screenshot of the app.</p>
  
  <p>The problem is however that the application quits after the test is completed and my job for screen capture takes  home screenshot which is not desired.</p>
  
  <p>Is there a way I could stop my application to quit so that the app screen is active and I get the desired screenshot?</p>
  
  <p>Below is test case which I have written. Also, I am not using any <code>tearDown</code> activity.</p>
  
  <pre><code>public class MyTest extends ActivityInstrumentationTestCase2 {
  
  private static final String LAUNCH_ACTIVITY_NAME = "com.demo.activity.MyActivity";
  
  private Solo solo;
  
  private static Class&lt;?&gt; splashActivityClass;
  static {
      try {
          splashActivityClass = Class.forName(LAUNCH_ACTIVITY_NAME);
      } catch (ClassNotFoundException e) {
          throw new RuntimeException(e);
      }
  }
  
  public Test() throws ClassNotFoundException {
      super(splashActivityClass);
  }
  
  @Override
  protected void setUp() throws Exception {
      solo = new Solo(getInstrumentation(), getActivity());
  }
  
  @SuppressLint({ "SimpleDateFormat", "NewApi" })
  public void testAllCountries() {
  
       // test goes here...
  }
  </code></pre>
  
  <p>I am taking screenshot via <code>adb</code> command which I execute in a separate job using <code>Java Runtime</code>.</p>