I\'m a bit confused with these two APIs.
ResourcesCompat.getDrawable(Resources res, int id, Resources.Theme theme)
Return a drawable
Here is my understand after some test
ContextCompat.getDrawable(@NonNull Context context, @DrawableRes int resId)
ResourcesCompat.getDrawable(@NonNull Resources res, @DrawableRes int id, @Nullable Theme theme)
AppCompatResources.getDrawable(@NonNull Context context, @DrawableRes int resId)
VectorDrawableCompat.create(@NonNull Resources res, @DrawableRes int resId, @Nullable Theme theme
The first thing see is VectorDrawableCompat and ResourcesCompat can specific theme
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); in onCreated of Application class
1) For vector image
API >= 21
ContextCompat work wellResourcesCompat work wellAppCompatResources work wellVectorDrawableCompat work wellAPI < 21
ContextCompat crashResourcesCompat crashAppCompatResources work wellVectorDrawableCompat work well2) For normal image
ContextCompat work wellResourcesCompat work wellAppCompatResources work wellVectorDrawableCompat crashAppCompatDelegate.setCompatVectorFromResourcesEnabled(true); in onCreated of Application class
1) For vector image
ContextCompat work wellResourcesCompat work wellAppCompatResources work wellVectorDrawableCompat work well2) For normal image
ContextCompat work wellResourcesCompat work wellAppCompatResources work wellVectorDrawableCompat crash