From 3ae652b13e4549742acccffc219150a1784c5224 Mon Sep 17 00:00:00 2001 From: Yedidya Kennard Date: Mon, 5 Sep 2016 11:18:45 +0300 Subject: [PATCH] Fixed bug using nullable getCurrentActivity instead of getReactApplicationContext for contentResolvers --- .../com/wix/RNCameraKit/gallery/NativeGalleryModule.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/com/wix/RNCameraKit/gallery/NativeGalleryModule.java b/android/src/main/java/com/wix/RNCameraKit/gallery/NativeGalleryModule.java index d85e57b..5693692 100644 --- a/android/src/main/java/com/wix/RNCameraKit/gallery/NativeGalleryModule.java +++ b/android/src/main/java/com/wix/RNCameraKit/gallery/NativeGalleryModule.java @@ -104,7 +104,7 @@ public class NativeGalleryModule extends ReactContextBaseJavaModule { private Bitmap getThumbnail(int thumbId) { return MediaStore.Images.Thumbnails.getThumbnail( - getCurrentActivity().getContentResolver(), + getReactApplicationContext().getContentResolver(), thumbId, MediaStore.Images.Thumbnails.MINI_KIND, null); @@ -113,7 +113,7 @@ public class NativeGalleryModule extends ReactContextBaseJavaModule { @ReactMethod public void getAlbumsWithThumbnails(Promise promise) { - Cursor imagesCursor = getCurrentActivity().getContentResolver().query( + Cursor imagesCursor = getReactApplicationContext().getContentResolver().query( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, ALBUMS_PROJECTION, null, null, null); AlbumList albums = getAlbumListFromCursor(imagesCursor); WritableArray arr = Arguments.createArray(); @@ -144,7 +144,7 @@ public class NativeGalleryModule extends ReactContextBaseJavaModule { builder.append(")"); String selection = builder.toString(); - Cursor cursor = getCurrentActivity().getContentResolver().query( + Cursor cursor = getReactApplicationContext().getContentResolver().query( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, IMAGES_PROJECTION, selection,