Resources¶
findByContext¶
findByContext
provides you with Context so that you can find the resources.
val drawable = findByContext {
AppCompatResources.getDrawable(this, R.drawable.android_logo)
}
try {
drawable = ResUtilsKt.findByContext(context ->
AppCompatResources.getDrawable(context, R.drawable.android_logo)
);
} catch (Exception e) {
throw new RuntimeException(e);
}
findByResources¶
findByResources
provides you with Resources so that you can find the resources.
val drawable = findByResources { res, theme ->
ResourcesCompat.getDrawable(res, R.drawable.android_logo, theme)
}
try {
drawable = ResUtilsKt.findByResources((resources, theme) ->
ResourcesCompat.getDrawable(resources, R.drawable.android_logo, theme)
);
} catch (Exception e) {
throw new RuntimeException(e);
}