Android Gets the HD app icon in one way, as follows
Public synchronized static drawable Geticonfrompackagename (String PackageName, Context context) {Packagemanager pm = C
Ontext.getpackagemanager (); if (Build.VERSION.SDK_INT >= build.version_codes.
ICE_CREAM_SANDWICH_MR1) {try {packageinfo pi = pm.getpackageinfo (packagename, 0);
Context Otherappctx = Context.createpackagecontext (PackageName, context.context_ignore_security); int displaymetrics[] = {Displaymetrics.density_xxxhigh,displaymetrics.density_xxhigh,displaymetrics.density_xhigh
, Displaymetrics.density_high, DISPLAYMETRICS.DENSITY_TV}; for (int displaymetric:displaymetrics) {try {drawable d = otherappctx.getresources (). Getdrawablefordensity (
Pi.applicationInfo.icon, Displaymetric);
if (d!= null) {return D;
The catch (Resources.notfoundexception e) {continue;
The catch (Exception e) {//Handle Error here}} applicationinfo appInfo = null; try {appInfo = Pm.getapplicationinfO (packagename, 0);
catch (Packagemanager.namenotfoundexception e) {return null;
Return Appinfo.loadicon (PM); }
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.