aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-01-13 12:57:16 -0800
committerScott Jackson <daneren2005@gmail.com>2013-01-13 12:57:16 -0800
commit5794fcb1dff0447c31786e04210c3f7e9c7f9302 (patch)
treead83af4dd29608af074dbf36f9191a41a2376eb6 /subsonic-android
parentc4130b7caa3ac11d4c1b9fdebf8459270a6b3ff1 (diff)
downloaddsub-5794fcb1dff0447c31786e04210c3f7e9c7f9302.tar.gz
dsub-5794fcb1dff0447c31786e04210c3f7e9c7f9302.tar.bz2
dsub-5794fcb1dff0447c31786e04210c3f7e9c7f9302.zip
Start of OutOfMemoryError handling in ImageLoader
Diffstat (limited to 'subsonic-android')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java b/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java
index 1965615c..a5038273 100644
--- a/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java
+++ b/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java
@@ -211,6 +211,15 @@ public class ImageLoader implements Runnable {
public void execute() {
try {
+ loadImage();
+ } catch(OutOfMemoryError e) {
+ Log.w(TAG, "Ran out of memory trying to load image, try cleanup and retry");
+ cache.clear();
+ loadImage();
+ }
+ }
+ public void loadImage() {
+ try {
MusicService musicService = MusicServiceFactory.getMusicService(mContext);
Bitmap bitmap = musicService.getCoverArt(mContext, mEntry, mSize, mSaveToFile, null);
@@ -222,7 +231,7 @@ public class ImageLoader implements Runnable {
} catch (Throwable x) {
Log.e(TAG, "Failed to download album art.", x);
}
- }
+ }
}
private abstract class ImageLoaderTaskHandler implements Runnable {