With new android API 22 getResources().getDrawable() is now deprecated. Now the best approach is to use only getDrawable().
getResources().getDrawable()
getDrawable()
What changed? <
In Kotlin you can use extension
fun Context.getMyDrawable(id : Int) : Drawable?{ return ContextCompat.getDrawable(this, id) }
then use like
context.getMyDrawable(R.drawable.my_icon)