PackageManager getApplicationIcon - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for PackageManager getApplicationIcon method.

This code example shows how to use the following methods:getApplicationIcon, getApplicationInfo, getPackagesForUid
 
    public static Drawable getAppIcon(Context c, int uid) {
        PackageManager pm = c.getPackageManager();
        Drawable appIcon = c.getResources().getDrawable(
                android.R.drawable.sym_def_app_icon);
        String[] packages = pm.getPackagesForUid(uid);
 
        if (packages != null) {
            if (packages.length == 1) {
                try { 
                    ApplicationInfo appInfo = pm.getApplicationInfo(
                            packages[0], 0);
                    appIcon = pm.getApplicationIcon(appInfo);
                } catch (NameNotFoundException e) {
                    Log.e(c.getPackageName(),
                            "No package found matching with the uid " + uid);
                } 
            } 
        } else { 
            Log.e(c.getPackageName(), "Package not found for uid " + uid);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getApplicationIcon
This code example shows how to use the following methods:getApplicationIcon
        return wrapped.getDefaultActivityIcon();
    } 
 
    @Override 
    public Drawable getApplicationIcon(ApplicationInfo info) {
        return wrapped.getApplicationIcon(info);
    } 
 
    @Override 
    public Drawable getApplicationIcon(String packageName) throws NameNotFoundException {
        return wrapped.getApplicationIcon(packageName);
    } 
 
    @Override 
    public Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException {
        return wrapped.getActivityLogo(activityName);
    } 
 
    @Override 
    public Drawable getActivityLogo(Intent intent) throws NameNotFoundException {
4
CodeRank
Experience pair programming with AI  Get Codota for Java

Related PackageManager getApplicationIcon Questions & Answers:

getApplicationIcon Method Overview
Retrieve the icon associated with an application.
See Code Examples for other Android PackageManager Methods: