I've created a Live Wallpaper that displays an animation by storing 70 or so images in an array and then displays them one at time to create the animation. I used the structure of the CubeEngine to design it. For the most part it works.
When I first select the wallpaper, it loads the array and displays the animation. Then when I click the "Set Wallpaper" button I get an "OutOfMemoryError: bitmap size exceeds VM Budget". I've added the bitmap.recycle() calls to try to resolve this.
I've put Log.d in all of the events to try to understand the flow of events. What it looks like is when the "Set Wallpaper" button is tapped, the flow goes straight to the Constructor.
The onDestroy event or the onSurfaceChanged events are not triggered, nor is any other event, except the onTouchEvent.
So my original array of images is in memory and when it executes the Constructor it attempts to load another array with images and runs out of memory.
I can not find an event to put logic into to clear out my original array when they click the "Set Wallpaper" button.
Is there a way to add logic to the "Set Wallpaper" button or is there another event I can add to my code where I should be able to do this?
I've seen others have this problem but have not seen a solution.
Any suggestions will be appreciated.