Code example for ResolveInfo

Methods: loadIcon

0
 
        // Set the name of the activity 
        result.putExtra(Intent.EXTRA_SHORTCUT_NAME, info.loadLabel(mPackageManager));
 
        // Build the icon info for the activity 
        Drawable drawable = info.loadIcon(mPackageManager);
        if (drawable instanceof BitmapDrawable) {
            BitmapDrawable bd = (BitmapDrawable) drawable;
            result.putExtra(Intent.EXTRA_SHORTCUT_ICON, bd.getBitmap());
        } 
//        ShortcutIconResource iconResource = new ShortcutIconResource(); 
//        iconResource.packageName = info.activityInfo.packageName; 
//        iconResource.resourceName = getResources().getResourceEntryName(info.getIconResource()); 
//        result.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); 
 
        // Set the result 
        setResult(RESULT_OK, result);
        finish();
    } 
}