Android Lint Warnings edit

Importing resources without Deprecated error

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 android.support.v4 library has another solution.

Add the following dependency to the build.gradle file:

com.android.support:support-v4:24.0.0

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);
DrawableCompat.setTint(drawable);
ContextCompat.getColor(context,R.color.colorPrimaryDark));

Moreover more methods from support library can be used:

ViewCompat.setElevation(textView, 1F);
ViewCompat.animate(textView);
TextViewCompat.setTextAppearance(textView, R.style.AppThemeTextStyle);
...

Feedback about page:

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


Table Of Contents
17 Lint Warnings
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close