Anmation in onResume blocked another activity's onDestroy
===

I have the following two activities, ActivityA and ActivityB.

In ActivityA.java

    startActivity(new Intent(this, ActivityB.class));
    finish();

In ActivityB.java

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

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

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

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.

Any suggestions? Thanks!
