Android getColor() Requires API Level 23

shape
shape
shape
shape
shape
shape
shape
shape

When using a newer API (API level 23) with support for older API’s (API Level 15), we have a small problem when trying to change the background programmatically.

“Call requires API level 23 (current min is 15)…”

To solve this problem, Android offers ContextCompat:

ContextCompat.getColor(context, R.color.suspendedAccount)

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Latest news

Latest news directly from our blog.