public override java.lang.CharSequence getText(string packageName, int resid, android.content.pm.ApplicationInfo appInfo) { android.app.ApplicationPackageManager.ResourceName name = new android.app.ApplicationPackageManager .ResourceName(packageName, resid); java.lang.CharSequence text = getCachedString(name); if (text != null) { return text; } if (appInfo == null) { try { appInfo = getApplicationInfo(packageName, 0); } catch (android.content.pm.PackageManager.NameNotFoundException) { return null; } } try { android.content.res.Resources r = getResourcesForApplication(appInfo); text = r.getText(resid); putCachedString(name, text); return text; } catch (android.content.pm.PackageManager.NameNotFoundException) { android.util.Log.w("PackageManager", "Failure retrieving resources for" + appInfo .packageName); } catch (java.lang.RuntimeException e) { // If an exception was thrown, fall through to return // default icon. android.util.Log.w("PackageManager", "Failure retrieving text 0x" + Sharpen.Util.IntToHexString (resid) + " in package " + packageName, e); } return null; }
public override android.graphics.drawable.Drawable getDrawable(string packageName , int resid, android.content.pm.ApplicationInfo appInfo) { android.app.ApplicationPackageManager.ResourceName name = new android.app.ApplicationPackageManager .ResourceName(packageName, resid); android.graphics.drawable.Drawable dr = getCachedIcon(name); if (dr != null) { return dr; } if (appInfo == null) { try { appInfo = getApplicationInfo(packageName, 0); } catch (android.content.pm.PackageManager.NameNotFoundException) { return null; } } try { android.content.res.Resources r = getResourcesForApplication(appInfo); dr = r.getDrawable(resid); if (false) { java.lang.RuntimeException e = new java.lang.RuntimeException("here"); XobotOS.Runtime.Util.FillInStackTrace(e); android.util.Log.w(TAG, "Getting drawable 0x" + Sharpen.Util.IntToHexString(resid ) + " from package " + packageName + ": app scale=" + r.getCompatibilityInfo().applicationScale + ", caller scale=" + mContext.getResources().getCompatibilityInfo().applicationScale , e); } putCachedIcon(name, dr); return dr; } catch (android.content.pm.PackageManager.NameNotFoundException) { android.util.Log.w("PackageManager", "Failure retrieving resources for" + appInfo .packageName); } catch (android.content.res.Resources.NotFoundException e) { android.util.Log.w("PackageManager", "Failure retrieving resources for" + appInfo .packageName + ": " + e.Message); } catch (java.lang.RuntimeException e) { // If an exception was thrown, fall through to return // default icon. android.util.Log.w("PackageManager", "Failure retrieving icon 0x" + Sharpen.Util.IntToHexString (resid) + " in package " + packageName, e); } return null; }