1

getColor(int) is deprecated .

How can I use getColor(int, theme theme)?

I used some lessons and I can't found how I can use getColor(int, theme theme).

MarianD
  • 13,096
  • 12
  • 42
  • 54
  • Have you looked at the resources? https://developer.android.com/reference/android/content/res/Resources.html#getColor(int, android.content.res.Resources.Theme) – Jake Kaupp Nov 26 '16 at 00:01

1 Answers1

5

Use something as

    ResourcesCompat.getColor(getResources(), R.color.red, null)

(Prior to API level 23 the theme will not be applied, so it may be null.)

MarianD
  • 13,096
  • 12
  • 42
  • 54