當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。