get Color Id from resource - Android App

Android examples for App:Resource

Description

get Color Id from resource

Demo Code

/**//from   ww w . j a  v  a  2 s  .c o m
 * Created by slynero at 2:23 on 14-7-18.
 * Copyright (c) 2014 FineSoft. All rights reserved.
 */
//package com.java2s;
import android.content.Context;

public class Main {
    public static int getColorId(Context paramContext, String paramString) {
        return paramContext.getResources().getIdentifier(paramString,
                "color", paramContext.getPackageName());
    }
}

Related Tutorials