title: Destroy middle activity in android
body: <p>I just saw a piece of code:</p>
  
  <pre><code>public class MyApplication extends Application {
  
          private List&lt;Activity&gt; activityList = new LinkedList&lt;Activity&gt;();
          private static MyApplication instance;
  
          private MyApplication() {
          }
  
          public static MyApplication getInstance() {
                  if (null == instance) {
                          instance = new MyApplication();
                  }
                  return instance;
  
          }
  
  
          public void addActivity(Activity activity) {
                  activityList.add(activity);
          }
  
  
          public void exit() {
  
                  for (Activity activity : activityList) {
                          activity.finish();
                  }
  
                  System.exit(0);
  
          }
  
  }
  </code></pre>
  
  <p>I never thought that we can take control of other activity beside the current one. I usually call finish() inside its own activity, now I saw this code, I realize that we can finish() other activity as well.</p>
  
  <p>Android stack is back stack architecture, so if I destroy any activity in the middle, what will happen? For example, I have 5 activity in the back stack, let say I finish() the third one, will the second and fourth be linked together now?</p>