Android Open Source - SampleAndroidL Code Utils

From Project

Back to project page SampleAndroidL.


The source code is released under:

GNU General Public License

If you think the Android project SampleAndroidL listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*  w  w  w . j av a 2  s  .  co m*/
import android.content.Context;

 * Created by Fabio Ranieri on 20/10/14.
 * Copyright 2014 Fingerlinks s.r.l.
public class CodeUtils {

     * @param context
     * @param name
     * @return
    public static int getImageResourceId(Context context, String name) {
        try {
            return context.getResources().
                    getIdentifier(name, "drawable", context.getPackageName());
        } catch (Exception e) {
            return -1;

Java Source Code List