I created a simple test application with one action. Activity contains a frame animation. The total size of the images in the frame animation (riffle_forward_anim) is about 1 MB. Here is the code I use to download the animation:
public class MainScreen extends Activity {
Private ImageView imgForward; Private ImageView imgBack;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
imgForward = (ImageView) findViewById(R.id.imgForward);
imgForward.setBackgroundResource(R.anim.riffle_forward_anim);
}
@Override
public void onPause(){
super.onPause();
AnimationDrawable anim = (AnimationDrawable) imgForward.getBackground();
int count = anim.getNumberOfFrames();
for(int i=0;i<count;i++){
anim.getFrame(i).setCallback(null);
}
imgForward.getBackground().setCallback(null);
imgForward = null;
}
}
As you can see, I am trying to free memory in the onPause () method. Yes, I read http://developer.android.com/resources/articles/avoiding-memory-leaks.html
, protrait/landscape.
, , . , , realisng.
- , ?