diff options
author | Daniel Sandler <dsandler@google.com> | 2009-09-21 15:13:31 -0400 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2009-11-10 21:08:40 -0800 |
commit | 1325f557bb2646cbaf00ed7d1de42b47cf59b895 (patch) | |
tree | d10261a5d8a4f609b38e0939d47f019a663cef78 /src/com/android/launcher2/WallpaperChooser.java | |
parent | 028b624e52d3f6b2f27e01566915084cbb6f0724 (diff) | |
download | android_packages_apps_Trebuchet-1325f557bb2646cbaf00ed7d1de42b47cf59b895.tar.gz android_packages_apps_Trebuchet-1325f557bb2646cbaf00ed7d1de42b47cf59b895.tar.bz2 android_packages_apps_Trebuchet-1325f557bb2646cbaf00ed7d1de42b47cf59b895.zip |
Stop crashing on invalid wallpaper thumbnail images.
We still won't be able to show a thumbnail, of course, but now instead of
crashing the picker we leave an empty box and write out a helpful Log.e such
as:
09-21 15:11:45.624: ERROR/Launcher(1539): Error decoding thumbnail resId=2130837544 for wallpaper #14
(Related to http://b/2113687.)
Diffstat (limited to 'src/com/android/launcher2/WallpaperChooser.java')
-rw-r--r-- | src/com/android/launcher2/WallpaperChooser.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/com/android/launcher2/WallpaperChooser.java b/src/com/android/launcher2/WallpaperChooser.java index a5cce067a..a74fa6a56 100644 --- a/src/com/android/launcher2/WallpaperChooser.java +++ b/src/com/android/launcher2/WallpaperChooser.java @@ -171,9 +171,17 @@ public class WallpaperChooser extends Activity implements AdapterView.OnItemSele } else { image = (ImageView) convertView; } - - image.setImageResource(mThumbs.get(position)); - image.getDrawable().setDither(true); + + int thumbRes = mThumbs.get(position); + image.setImageResource(thumbRes); + Drawable thumbDrawable = image.getDrawable(); + if (thumbDrawable != null) { + thumbDrawable.setDither(true); + } else { + Log.e(Launcher.LOG_TAG, String.format( + "Error decoding thumbnail resId=%d for wallpaper #%d", + thumbRes, position)); + } return image; } } |