Java tutorial
//package com.java2s; import android.content.Context; import android.content.res.Resources; public class Main { private static Context sContext; public static int getColor(int resId) { return getResources().getColor(resId); } public static Resources getResources() { return getContext().getResources(); } public static Context getContext() { if (sContext != null) return sContext; throw new NullPointerException("u should init first"); } }