Hi,
I want to use this extension in my android project,
I created a file called KotlinExtension.kt
in the root of the package:
package some.name
...
fun Context.getDrawable(resId: Int): Drawable {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getDrawable(resId)
} else {
resources.getDrawable(resId)
}
}
I want to access this custom extension from another file under the same package:
package some.name.activities
import some.name.KotlinExtension.*
...
class activity: Activity() {
fun test() {
context.getDrawable(R.some.drawable)
}
}
But it references it to the regular context.getDrawable
function…
How can I access this extension?
Thanks.