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.)
This commit is contained in:
Daniel Sandler
2009-09-21 15:13:31 -04:00
committed by Joe Onorato
parent 028b624e52
commit 1325f557bb
@@ -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;
}
}