Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.res.Resources;

import android.graphics.drawable.Drawable;

public class Main {
    public static Drawable getAndroidDrawable(final String drawableName) {
        final int resourceId = Resources.getSystem().getIdentifier(drawableName, "drawable", "android");
        if (resourceId == 0) {
            return null;
        } else {
            return Resources.getSystem().getDrawable(resourceId);
        }
    }
}