Android getColor() Requires API Level 23

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)

 

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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