Java tutorial
//package com.java2s; import android.content.res.Resources; import android.graphics.drawable.Drawable; public class Main { private static Drawable getDrawable(Resources resources, int id) { try { return resources.getDrawable(id); } catch (Resources.NotFoundException e) { // do nothing. } return null; } }