android-ibc-forum

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 1c01b009a40f6279b2ea7dfe4a1d84f67bcaba3f
parent ceda9731935dc3ad7de64ed00a0b8daadc998657
Author: Jan Dankert <devnull@localhost>
Date:   Sat, 11 Feb 2012 00:20:04 +0100

Fix: OutOfMemory abfangen, falls Bild zu groß ist.

Diffstat:
src/de/mtbnews/android/image/URLImageParser.java | 17++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/de/mtbnews/android/image/URLImageParser.java b/src/de/mtbnews/android/image/URLImageParser.java @@ -108,7 +108,22 @@ public class URLImageParser implements ImageGetter return drawableFromCache; InputStream is = fetch(urlString); - Drawable drawable = Drawable.createFromStream(is, "src"); + Drawable drawable = null; + try + { + drawable = Drawable.createFromStream(is, "src"); + } + catch (OutOfMemoryError e) + { + Log.w(IBC.TAG, "OutOfMemory: Image too big: " + + e.getMessage(), e); + } + catch (Exception e) + { + Log + .w(IBC.TAG, "unable to load image: " + + e.getMessage(), e); + } if (drawable == null) Log.w(IBC.TAG, "drawable is null, url=" + urlString); else