'How to use variables for Manifest.permission names in Kotlin?
I want to use variables for permission names in Kotlin. Specifically, in the code below, I want $Permission to subsutitute object.
checkPermission("Manifest.permission.ACCESS_FINE_LOCATION");
fun checkPermission(PermissionString:String): Boolean {
val Permission = (Make PermissionString an object somehow)
return ActivityCompat.checkSelfPermission(
Context,
Permission
) == PackageManager.PERMISSION_GRANTED
}
Appreciate any responses. Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
