Java tutorial
//package com.java2s; import android.graphics.drawable.Drawable; import android.graphics.drawable.StateListDrawable; public class Main { public static Drawable getSelectedStateDrawable(Drawable normal, Drawable selected) { StateListDrawable drawable = new StateListDrawable(); drawable.addState(new int[] { -android.R.attr.state_selected }, normal); drawable.addState(new int[] { android.R.attr.state_selected }, selected); return drawable; } }