Using setImageResource() should fetch its resource in a backwards-compatible manner without any further effort required.
However if you are using setImageDrawable(), the ImageView/ImageButton will not help with any backwards compat and it's up to you to supply a backward-compat drawable, which is important for eg. if using VectorDrawables. The following will load and set a drawable in such a way:
val drawable = AppCompatResources.getDrawable(context, resourceId)
image.setImageDrawable(drawable)