1

Right now I am working in developing live wallpaper. I have around 75 animation images for my main character and in one spot I can't able to load it into memory. It throws an OutOfMomory exception.

Basically I have to continuously change frame of my main character from first to last. So I write algorithm for loading required image and unload other image. But it calls garbage collector program continuously so as a result animation can't run smoothly as per expectation.

So how to manage that much images for live wallpaper?? Please provide some guidance here.

Siddharth
  • 4,142
  • 9
  • 44
  • 90

2 Answers2

1

Maybe the tips Nicolas posted here will help you.

Short version:

  1. Reduce texture sizes.
  2. Reduce texture switches (aka try to use spritesheets, so that the texture needs to be changed as few as possible)
  3. Use lower quality textures (RGBA4444 or RGB565 instead of RGBA8888)..
  4. Call setIgnoreUpdate where the entity doesn't need updates.
  5. Use SpriteBatches if possible.
Community
  • 1
  • 1
LordRaydenMK
  • 13,074
  • 5
  • 50
  • 56
1

You can also add "android:largeHeap=true" in your application tag along with the tips LordRaydenMK has suggested.

Hiemanshu Sharma
  • 7,702
  • 1
  • 16
  • 13