jeudi 6 mars 2014

Toggle Playing GIFs bitmap size exceeds VM budget


Vote count:

0




i want to play different gifs in my app, using only a ImageView which toggles the GIF to be shown. The first one i play shows properly, bu when i toggle to the next one, crash with out of memory error caused by the Bitmap size... My code:



private void PlayAnimation(int op){ //op is the R.drawable.animX file
//containing all the images in items inside an animation-list
if(frameAnimation!=null && frameAnimation.isRunning())
{
frameAnimation.stop();
}

recycleImagesFromView(animImageView);//indeed i clear the memory
animImageView.setImageDrawable(getResources().getDrawable(animados[op]));
animImageView.post(new Runnable() {
@Override
public void run() {
frameAnimation = (AnimationDrawable) animImageView.getDrawable();
frameAnimation.start();
}
});
}


What's wrong??



asked 17 secs ago






Aucun commentaire:

Enregistrer un commentaire