From 5beadedfe23f5faab8db6b0ea3a9860b01651268 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 31 May 2017 23:39:13 +0200 Subject: [PATCH] small tweak to viewpager cursor --- .../gallery/activities/ViewPagerActivity.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 95024233f..a8f4c20f0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -73,10 +73,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View try { val proj = arrayOf(MediaStore.Images.Media.DATA) cursor = contentResolver.query(uri, proj, null, null, null) - if (cursor != null) { - val dataIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA) - cursor.moveToFirst() - mPath = cursor.getString(dataIndex) + if (cursor?.moveToFirst() == true) { + mPath = cursor.getStringValue(MediaStore.Images.Media.DATA) } } finally { cursor?.close()