Check Mobile App
Read now
Start a Project

What to use instead of getResources().getColor() because this is now deprecated


In this blog,
I have talked about what to use instead of a deprecated function of getColor.
getResources().getColor(R.color.color_name) is deprecated in API level 23.
So, we can use getColor(int, Theme) instead.


you can use the ContextCompat.getColor() which is part of the Support V4 Library (so it will work for all the previous API).

instead of

getColor method

Returns a color connected with a particular resource ID.


. . .

Leave a Comment

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


  • Cryptonix
    Thanks this was very useful 🙂
  • Android Developer
    What’s the use of the theme, though?
  • Ricardo
    Many thanks for solving as fast as light 🙂
  • css.php

    The support is fast and do everything in their power to make it perfect. If you need customization it's also done right away. I had massive research to select Mobikul and now I'm sure it was the right one.

    Igor Souza

    Igor Souza

    Talk to Sales


    Live Chat
    Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home