Java Code Examples for android.content.pm.PackageManager.getDefaultActivityIcon()

The following are Jave code examples for showing how to use getDefaultActivityIcon() of the android.content.pm.PackageManager class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: DroidPlugin   File: ApkItem.java   Source Code and License Vote up 5 votes
ApkItem(PackageManager pm, PackageInfo info, String path) {
    try {
        icon = pm.getApplicationIcon(info.applicationInfo);
    } catch (Exception e) {
        icon = pm.getDefaultActivityIcon();
    }
    title = pm.getApplicationLabel(info.applicationInfo);
    versionName = info.versionName;
    versionCode = info.versionCode;
    apkfile = path;
    packageInfo = info;
}
 
Example 2
Project: Treebolic   File: Services.java   Source Code and License Vote up 5 votes
/**
 * Load icon
 *
 * @param packageManager package manager
 * @param packageName    package name
 * @param iconId         icon id
 * @return drawable
 */
static public Drawable loadIcon(@NonNull final PackageManager packageManager, final String packageName, final int iconId)
{
	if (iconId != 0)
	{
		return packageManager.getDrawable(packageName, iconId, null);
	}
	return packageManager.getDefaultActivityIcon();
}