当前位置: 首页>>代码示例>>Java>>正文


Java ResolveInfo.getIconResource方法代码示例

本文整理汇总了Java中android.content.pm.ResolveInfo.getIconResource方法的典型用法代码示例。如果您正苦于以下问题:Java ResolveInfo.getIconResource方法的具体用法?Java ResolveInfo.getIconResource怎么用?Java ResolveInfo.getIconResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.pm.ResolveInfo的用法示例。


在下文中一共展示了ResolveInfo.getIconResource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadIconForResolveInfo

import android.content.pm.ResolveInfo; //导入方法依赖的package包/类
Drawable loadIconForResolveInfo(ResolveInfo ri) {
    Drawable dr;
    try {
        if (ri.resolvePackageName != null && ri.icon != 0) {
            dr = getIcon(mPm.getResourcesForApplication(ri.resolvePackageName), ri.icon);
            if (dr != null) {
                return dr;
            }
        }
        final int iconRes = ri.getIconResource();
        if (iconRes != 0) {
            dr = getIcon(mPm.getResourcesForApplication(ri.activityInfo.packageName), iconRes);
            if (dr != null) {
                return dr;
            }
        }
    } catch (PackageManager.NameNotFoundException e) {
        VLog.e(TAG, "Couldn't find resources for package\n" + VLog.getStackTraceString(e));
    }
    return ri.loadIcon(mPm);
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:22,代码来源:ResolverActivity.java

示例2: loadIconForResolveInfo

import android.content.pm.ResolveInfo; //导入方法依赖的package包/类
Drawable loadIconForResolveInfo(ResolveInfo ri) {
    Drawable dr;
    try {
        if (ri.resolvePackageName != null && ri.icon != 0) {
            dr = getIcon(mPm.getResourcesForApplication(ri.resolvePackageName), ri.icon);
            if (dr != null) {
                return dr;
            }
        }
        final int iconRes = ri.getIconResource();
        if (iconRes != 0) {
            dr = getIcon(mPm.getResourcesForApplication(ri.activityInfo.packageName), iconRes);
            if (dr != null) {
                return dr;
            }
        }
    } catch (PackageManager.NameNotFoundException e) {
        VLog.e(TAG, "Couldn't find resources for package\n"+VLog.getStackTraceString(e));
    }
    return ri.loadIcon(mPm);
}
 
开发者ID:codehz,项目名称:container,代码行数:22,代码来源:ResolverActivity.java

示例3: loadIconForResolveInfo

import android.content.pm.ResolveInfo; //导入方法依赖的package包/类
private Drawable loadIconForResolveInfo(ResolveInfo info) {
    try {
        final int iconRes = info.getIconResource();
        if (iconRes != 0) {
            Resources res = mManager.getResourcesForApplication(info.activityInfo.packageName);
            Drawable icon = ApiCompatibilityUtils.getDrawable(res, iconRes);
            return icon;
        }
    } catch (NameNotFoundException | NotFoundException e) {
        // Could not find the icon. loadIcon call below will return the default app icon.
    }
    return info.loadIcon(mManager);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:14,代码来源:ShareDialogAdapter.java


注:本文中的android.content.pm.ResolveInfo.getIconResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。