small tweak to viewpager cursor

This commit is contained in:
tibbi 2017-05-31 23:39:13 +02:00
parent 6248f0db76
commit 5beadedfe2
1 changed files with 2 additions and 4 deletions

View File

@ -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()