Understanding memory leak in Android app.
        Posted  
        
            by 
                sat
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by sat
        
        
        
        Published on 2011-02-16T07:07:38Z
        Indexed on 
            2011/02/16
            7:25 UTC
        
        
        Read the original article
        Hit count: 196
        
android
|Performance
After going through few articles about performance, Not able to get this statement exactly.
"When a Drawable is attached to a view, the view is set as a callback on the drawable"
Soln: "Setting the stored drawables’ callbacks to null when the activity is destroyed."
What does that mean, e.g.
In my app , I initialize an imageButton in onCreate() like this,
imgButton= (ImageButton) findViewById(R.id.imagebtn);
At later stage, I get an image from an url, get the stream and convert that to drawable, and set image btn like this,
imgButton.setImageDrawable(drawable);
According to the above statement, when I am exiting my app, say in onDestroy() I have to set stored drawables’ callbacks to null, not able to understand this part ! In this simple case what I have to set as null ?
I am using Android 2.2 Froyo, whether this technique is required, or not necessary.
© Stack Overflow or respective owner