I received a strange out of bounds exception in the Play Store console relating to the android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback
j
Kotlin code for check Permission & Fix this error: It's better to check size of IntArray with .isNotEmpty() in Kotlin.
override fun onRequestPermissionsResult(
requestCode: Int, permissions: Array,
grantResults: IntArray
) {
when (requestCode) {
PERMISSIONS_REQUEST_PICK_IMAGE_GALLERY -> {
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
choosePhotoFromGallary()
} else //Permission Denied
// toast("Permission must be granted in order to...")
}
PERMISSIONS_REQUEST_TAKE_PICTURE_CAMERA -> {
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
takePhotoFromCamera()
} else //Permission Denied
// toast("Permission must be granted in order to ...")
}
} // when
} // fun