0

I have created a simple image slider 'Live Wallpaper' that will call in an image upon DoubleTap. I know there has been many different OOM issues when dealing with images in that the Android System must convert the image into a BMP which essentially increases the image size substantially.

My question is when I activate the Live Wallpaper from the Live Wallpaper Menu screen and view it in Preview mode, it works perfectly. I am able to browse through all my images without any lag or problems. However, when I go to SET the Live Wallpaper, it crashes with an OOM error. Any reason why this could be?

1 Answers1

1

Preview Mode is drawn on an opaque surface whereas your desktop draws both icons, updates and animations over it.

Have you optimized the graphics? That could help quite a bit ... something like http://trimage.org if you are using jpg/png.

TryTryAgain
  • 7,632
  • 11
  • 46
  • 82
  • All my graphics are optimized via 'Save For Web' within Photoshop. I use a 960x800 image which seems to work great for most hdpi and xhdpi screen densities sans tablets. My file size for each image is roughly 150-250kb each. However, I was under the impression that regardless of the file size, the resolution of the image is what determines the actual file size once the Android system converts it into a BMP. That process usually blows the image up to 1-2mb which agreeably is rather larger. Anyways, thanks for your help! –  Jan 12 '12 at 18:29
  • Wait. Which devices does it fail on? Maybe you need to accommodate with providing different resources for different devices. This will inevitably increase the size of the APK but increase performance on problem devices. http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources ALSO, http://photobatch.stani.be/ can help you batch convert to respective DPIs and resolutions. – TryTryAgain Jan 12 '12 at 18:36
  • For HDPI I am using 960x800. MDPI @ 720x600. LDPI images @ 480x400. Yet when I go to SET the Live Wallpaper I get a variation of this error: E/dalvikvm-heap(15936): 682240-byte external allocation too large for this process. E/dalvikvm(15936): Out of memory: Heap Size=4499KB, Allocated=2555KB, Bitmap Size=11606KB, Limit=13756KB E/dalvikvm(15936): Trim info: Footprint=2883KB, Allowed Footprint=4867KB, Trimmed=368KB 01-12 12:01:15.896: E/GraphicsJNI(15936): VM won't let us allocate 682240 bytes –  Jan 12 '12 at 19:02
  • Yeah, that's pretty large. I would look into how Photoshop 'save for web' may be lacking compared to trimage or _"better than photoshop's" save for web osx_ search on google. Good luck. – TryTryAgain Jan 12 '12 at 19:06