With new android API 22 getResources().getDrawable()
is now deprecated.
Now the best approach is to use only getDrawable()
.
What changed? <
For some who still got this issue to solve even after applying the suggestion of this thread(i used to be one like that) add this line on your Application class, onCreate() method
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
As suggested here and here sometimes this is required to access vectors from resources especially when you're dealing with menu items, etc