Anmation in onResume blocked another activity's onDestroy
<p>I have the following two activities, ActivityA and ActivityB.</p>

<p>In ActivityA.java</p>

<pre><code>startActivity(new Intent(this, ActivityB.class));
finish();
</code></pre>

<p>In ActivityB.java</p>

<pre><code>public void onResume() {
    super.onResume();
    anim1 = new TranslateAnimation(0, 0, fromYDelta, -height);
    anim1.setDuration(8000);
    anim1.setFillAfter(true);
    anim1.setStartOffset(0);
    aView.startAnimation(anim1);
}
</code></pre>

<p>After the code in ActivityA that starts ActivityB and finishes itself has run, the activity life cycle callbacks were called in this order:</p>

<pre><code>ActivityA.onPause();
ActivityB.onStart();
ActivityB.onResume(); //Start 8 seconds animation here
ActivityA.onStop();
ActivityA.onDestroy();
</code></pre>

<p>Now the issue is that ActivityA.onStop() was called 8 seconds after ActivityB.onResume() is called because of the 8-seconds animation started in ActivityB's onResume(). It caused OutOfMemoryError in my app, because ActivityA.onDestroy() was called very late and the system had to hold all the resources in ActivityA for a long time.</p>

<p>Any suggestions? Thanks!</p>
