Here you can find the source of getDrawable(final Context context, final String packageName, final int resourceID)
public static Drawable getDrawable(final Context context, final String packageName, final int resourceID)
//package com.java2s; import android.content.Context; import android.content.pm.PackageManager.NameNotFoundException; import android.graphics.drawable.Drawable; public class Main { public static Drawable getDrawable(final Context context, final String packageName, final int resourceID) { Drawable drawable = null;/* w w w.jav a2 s. c om*/ Context remoteContext = null; try { remoteContext = context.createPackageContext(packageName, 0); drawable = remoteContext.getResources().getDrawable(resourceID); } catch (final NameNotFoundException e) { e.printStackTrace(); } return drawable; } }