summaryrefslogtreecommitdiffstats
path: root/photoviewer
diff options
context:
space:
mode:
Diffstat (limited to 'photoviewer')
-rw-r--r--photoviewer/src/com/android/ex/photo/loaders/PhotoBitmapLoader.java4
-rw-r--r--photoviewer/src/com/android/ex/photo/util/ImageUtils.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/photoviewer/src/com/android/ex/photo/loaders/PhotoBitmapLoader.java b/photoviewer/src/com/android/ex/photo/loaders/PhotoBitmapLoader.java
index 7049370..fe42e0d 100644
--- a/photoviewer/src/com/android/ex/photo/loaders/PhotoBitmapLoader.java
+++ b/photoviewer/src/com/android/ex/photo/loaders/PhotoBitmapLoader.java
@@ -52,7 +52,9 @@ public class PhotoBitmapLoader extends AsyncTaskLoader<Bitmap> {
final ContentResolver resolver = context.getContentResolver();
Bitmap bitmap = ImageUtils.createLocalBitmap(resolver, Uri.parse(mPhotoUri),
PhotoViewFragment.sPhotoSize);
- bitmap.setDensity(DisplayMetrics.DENSITY_MEDIUM);
+ if (bitmap != null) {
+ bitmap.setDensity(DisplayMetrics.DENSITY_MEDIUM);
+ }
return bitmap;
}
diff --git a/photoviewer/src/com/android/ex/photo/util/ImageUtils.java b/photoviewer/src/com/android/ex/photo/util/ImageUtils.java
index 501356e..9c1636b 100644
--- a/photoviewer/src/com/android/ex/photo/util/ImageUtils.java
+++ b/photoviewer/src/com/android/ex/photo/util/ImageUtils.java
@@ -86,7 +86,7 @@ public class ImageUtils {
* @param uri The local URI
* @param maxSize The maximum size (either width or height)
*
- * @return The new bitmap
+ * @return The new bitmap or null
*/
public static Bitmap createLocalBitmap(ContentResolver resolver, Uri uri, int maxSize) {
// TODO: make this method not download the image for both getImageBounds and decodeStream
@@ -195,3 +195,4 @@ public class ImageUtils {
return resolver.openInputStream(uri);
}
}
+