title: What exactly does onDestroy() destroy?
body: <p>I've been bothered by this "characteristics": When I use Back button to leave my app, I can tell onDestroy() is called, but the next time I run my app, all the static members of the Activity class still retain their values. See the code below:</p>
  
  <pre><code>public class HelloAndroid extends Activity {
  
  private static int mValue;   // a static member here
  
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      TextView tv = new TextView(this);
      tv.setText((mValue != 0) ? 
          ("Left-over value = " + mValue) : "This is a new instance");
      setContentView(tv);
  }
  
  public void onDestroy() {
      super.onDestroy();
      mValue++;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The above code displays the left-over value in mValue, and it increments when the session ends so that I know for sure the onDestroy() is called. </p>
  
  <p>I found a <a href="https://stackoverflow.com/questions/4461999/android-is-ondestroy-supposed-to-destroy-the-activity-its-variables-and-free">useful answer</a> on this forum, and I understand in the above code mValue is a class member, instead of an instance member. But isn't it true that, in this particular case, I have only one single HelloAndroid activity, and so When he dies, everything is cleaned up, and the next time I come back, everything starts over again? (Or, is there some other misterious thing in the system still holds on to it after onDestroy() so that it just won't die???)</p>
  
  <p>(The above is just a variable, what if it's a bunch of objec references? Each piece is a separately re-collectable memory. Is there a chance that GC collects some of them but not all-or-none? This really bugs me.)</p>