Here you can find the source of getApplicationIcon(String packageName)
public static Drawable getApplicationIcon(String packageName)
//package com.java2s; import android.app.Activity; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.graphics.drawable.Drawable; public class Main { private static Activity mContext; public static Drawable getApplicationIcon(String packageName) { if (mContext == null) return null; try {//w w w . j av a 2s. c om return mContext.getPackageManager().getApplicationIcon( packageName); } catch (NameNotFoundException e) { // TODO Auto-generated catch block return null; } } public static Drawable getApplicationIcon(ApplicationInfo ai) { if (mContext != null) return mContext.getPackageManager().getApplicationIcon(ai); else return null; } }