Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.res.Resources; import android.util.SparseIntArray; public class Main { private static SparseIntArray sColorArray; public static int[] getColorArray(Context context) { int length = sColorArray.size() / 2; int[] colorArray = new int[length]; Resources res = context.getResources(); for (int i = 0; i < length; i++) { colorArray[i] = res.getColor(sColorArray.get(i)); } return colorArray; } }