Search code examples
androidlive-wallpaper

live wallpaper force closing issue


When I start my live wallpaper app, it loads successfully.
When I press "set as wallpaper" it throws a "stopped unexpectedly" error.
When I press force-close from there, the app fires up just fine, no problems, and gets set as my wallpaper and works perfect.

Im trying to get rid of this intermittent force-close.
Ive tested my app on several real phones and it happens on some phones and not others.

Heres my logcat at the moment it throws this error:


04-01 11:26:13.685: INFO/ActivityManager(122): Displayed activity com.android.wallpaper.livepicker/.LiveWallpaperPreview: 524 ms (total 524 ms)  
04-01 11:26:14.445: ERROR/dalvikvm-heap(4766): 384000-byte external allocation too large for this process.
04-01 11:26:14.445: DEBUG/skia(4766): --- decoder->decode returned false
04-01 11:26:14.445: WARN/dalvikvm(4766): threadid=3: thread exiting with uncaught exception (group=0x400262e8)
04-01 11:26:14.455: ERROR/AndroidRuntime(4766): Uncaught handler: thread main exiting due to uncaught exception
04-01 11:26:14.465: ERROR/AndroidRuntime(4766): java.lang.OutOfMemoryError: bitmap size exceeds VM budget


Again, after I press force-close, everything works with no further memory errors.
The app is targeted for 2.1, made with eclipse on xp-machine


Solution

  • I came up with a simple solution! I added an OutOfMemoryError try/catch with a toast message I needed anyway in the catch. Cleared it right up!