I am using a simple frame animation and when I exit and reenter my
activity the activity is still referenced in memory. Any Ideas?

//This is a sample activity I created to simulate the problem
public class MemoryLeakActivity extends Activity {

    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
        public boolean onKeyDown(final int keyCode, final KeyEvent event) {
        final Intent i = new Intent(MemoryLeakActivity.this, LeakyActivy.class);
        startActivity(i);
                return super.onKeyDown(keyCode, event);
        }
}

//This is the activity that runs the frame animation
public class LeakyActivy extends Activity {

        AnimationDrawable frameAnimation;
        
        @Override
        protected void onCreate(final Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                
                setContentView(R.layout.main);
                
                final View v = findViewById(R.id.main);
                
                v.setBackgroundResource(R.drawable.awe);
                
                frameAnimation = (AnimationDrawable) v.getBackground();
                
        }

        @Override
        public boolean onKeyDown(final int keyCode, final KeyEvent event) {
                frameAnimation.start();
                return super.onKeyDown(keyCode, event);
        }

}


If I start LeakyActivity then hit the back button then start
LeakyActivity again it stays in memory. I know this because I have
been dumping the HPROF files.

-- 
Joshua Frank

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to