Getting resources without deprecated warnings

suggest change

Using the Android API 23 or higher, very often such situation can be seen:

This situation is caused by the structural change of the Android API regarding getting the resources. Now the function:

public int getColor(@ColorRes int id, @Nullable Theme theme) throws NotFoundException

should be used. But the library has another solution.

Add the following dependency to the build.gradle file:

Then all methods from support library are available:

ContextCompat.getColor(context, R.color.colorPrimaryDark);
ContextCompat.getDrawable(context, R.drawable.btn_check);
ContextCompat.getColorStateList(context, R.color.colorPrimary);

Moreover more methods from support library can be used:

ViewCompat.setElevation(textView, 1F);

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents