Java tutorial
//package com.java2s; //License from project: Apache License import android.content.res.ColorStateList; public class Main { private static ColorStateList createColorStateList(int checked, int normal) { int[] colors = new int[] { checked, normal }; int[][] states = new int[2][]; states[0] = new int[] { android.R.attr.state_checked, android.R.attr.state_enabled }; states[1] = new int[] {}; return new ColorStateList(states, colors); } private static ColorStateList createColorStateList(String b, int pressed, int normal) { int[] colors = new int[] { pressed, normal }; int[][] states = new int[2][]; states[0] = new int[] { android.R.attr.state_pressed, android.R.attr.state_enabled }; states[1] = new int[] {}; return new ColorStateList(states, colors); } }