Home > Blockchain >  getColor(int id) deprecated
getColor(int id) deprecated

Time:11-16

I solved it like this, do you think it is correct?

 getColor(int id, Theme theme);

`getColor(R.color.green, getContext().getTheme());`

where "green" is in resources / colors:

`color name="green">#ff00ff00</color>`

CodePudding user response:

Use ContextCompat.getColor(context, R.color.colorName) As this answer shows: getResources().getColor() is deprecated

CodePudding user response:

you will find better answers here, These are the top-rated answers.answers.

  • Related