Java tutorial
//package com.java2s; import android.graphics.Color; public class Main { /** * Gets the color. * * @param position the position * @param transparent the transparent * @return the color */ public static int getColor(int position, boolean transparent) { position = position % 5; switch (position) { case 0: return Color.argb(transparent ? 100 : 255, 240, 91, 0); case 1: return Color.argb(transparent ? 100 : 255, 246, 117, 184); case 2: return Color.argb(transparent ? 100 : 255, 187, 187, 1); case 3: return Color.argb(transparent ? 100 : 255, 0, 156, 239); case 4: return Color.argb(transparent ? 100 : 255, 0, 177, 4); } return 0; } }