title: Android Application closing when debugging code block finishes
body: <p>I've just setup a dev environment for an existing android app. Everything appears to be setup correctly, I can build the app, add breakpoints and debug the app. But i've noticed some odd behavior and i can't seem to find anything related to the problem.</p>
  <ol>
  <li>When i start the emulator or run the app on a device i can walk though the app and everything works as expected</li>
  <li>When i run the debugger and ad a breakpoint the breakpoint is hit fine and i can step through the code.</li>
  <li>When i step out of the last code block that had the initial break point using F7(step-into) or F8(step-over) the application closes and the debugger stops. There are no errors in android monitor &gt; logcat.</li>
  <li>If i do the same set of step but instead use F9 to resume the program the application does not close and everything runs normally.</li>
  </ol>
  <p>It seems like this might have something to do with the activity thread finishing and probably a Android Studio debug option? I'm not really sure though, i'm still new to android development.</p>
  <p>Why would the debugger be stopping like this? Is there a way to ensure you run to the next breakpoint?</p>
  <h3>Edit</h3>
  <p>I can also reproduce this with a new android project my adding a breakpoint into the OnCreate method and stepping through to he end like this</p>
  <pre><code>    @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);    &lt;------- Breakpoint added here
      setContentView(R.layout.activity_main);
      
      ......
      
      NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
      navigationView.setNavigationItemSelectedListener(this);
  }    &lt;------- Application terminates after this line
  </code></pre>