How do I create ColorStateList programmatically?

I am trying to create a ColorStateList programatically using this: ColorStateList stateList = new ColorStateList(states, colors); But I am not sure what are the two parameters. As per the documentation: public ColorStateList (int[][] states, int[] colors) Added in API level 1 Creates a ColorStateList that returns the specified mapping from states to colors. Can somebody … Read more

getResources().getColor() is deprecated [duplicate]

This question already has answers here: getColor(int id) deprecated on Android 6.0 Marshmallow (API 23) (13 answers) Closed 6 years ago. Using: buildToolsVersion “22.0.1” , targetSdkVersion 22 in my gradle file. I found that the useful getResources().getColor(R.color.color_name) is deprecated. What should I use instead? 4 s 4