I get out of memory exceptions when loading images into my app. I integrated Picasso to load images, but the code below is not working with an animation-list for an AnimationDrawable. The animation is null:
Picasso.with(this).load(R.drawable.qtidle).into(qtSelectButton);
qtIdleAnimation = (AnimationDrawable)qtSelectButton.getDrawable();
if (qtIdleAnimation != null)
qtIdleAnimation.start();
The AnimationDrawable works, if I use this code without Picasso:
qtIdleAnimation = new AnimationDrawable();
qtIdleAnimation.setOneShot(false);
for (int i = 1; i <= 7; i++) {
int qtidleId = res.getIdentifier("qtidle" + i, "drawable", this.getPackageName());
qtIdleAnimation.addFrame(res.getDrawable(qtidleId), 100);
}
qtSelectButton.setImageDrawable(qtIdleAnimation);
if (qtIdleAnimation != null)
qtIdleAnimation.start();
But this code causes the out of memory exceptions. Is it possible at all to load animation-lists with Picasso?