PackageManager getText - 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 getText method.

This code example shows how to use the following methods:getDrawable, getText
                // human readable. 
                String packageName = description.packageName;
                PackageManager pm = getPackageManager();
 
                if (description.labelId != 0) {
                    mTypeLabel = pm.getText(packageName, description.labelId, null);
                    if (mTypeLabel == null) {
                        throw new IllegalArgumentException("LabelID provided, but label not found");
                    } 
                } else { 
                    mTypeLabel = "";
                } 
 
                if (description.iconId != 0) {
                    mIcon = pm.getDrawable(packageName, description.iconId, null);
                    if (mIcon == null) {
                        throw new IllegalArgumentException("IconID provided, but drawable not " +
                                "found"); 
                    } 
                } else { 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getDrawable, getText
                // human readable. 
                String packageName = description.packageName;
                PackageManager pm = getPackageManager();
 
                if (description.labelId != 0) {
                    mTypeLabel = pm.getText(packageName, description.labelId, null);
                    if (mTypeLabel == null) {
                        throw new IllegalArgumentException("LabelID provided, but label not found");
                    } 
                } else { 
                    mTypeLabel = "";
                } 
 
                if (description.iconId != 0) {
                    mIcon = pm.getDrawable(packageName, description.iconId, null);
                    if (mIcon == null) {
                        throw new IllegalArgumentException("IconID provided, but drawable not " +
                                "found"); 
                    } 
                } else { 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getText
    } 
 
    public CharSequence getDisplayLabel(Context context) {
        if (this.titleRes != -1 && this.summaryResPackageName != null) {
            final PackageManager pm = context.getPackageManager();
            return pm.getText(this.summaryResPackageName, this.titleRes, null);
        } else if (this.titleRes != -1) {
            return context.getText(this.titleRes);
        } else { 
            return this.accountType;
        } 
    } 
 
    public Drawable getDisplayIcon(Context context) {
        if (this.titleRes != -1 && this.summaryResPackageName != null) {
            final PackageManager pm = context.getPackageManager();
            return pm.getDrawable(this.summaryResPackageName, this.iconRes, null);
        } else if (this.titleRes != -1) {
            return context.getResources().getDrawable(this.iconRes);
        } else { 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getText
        return wrapped.getApplicationLogo(packageName);
    } 
 
    @Override 
    public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
        return wrapped.getText(packageName, resid, appInfo);
    } 
 
    @Override 
    public XmlResourceParser getXml(String packageName, int resid,
            ApplicationInfo appInfo) {
        return wrapped.getXml(packageName, resid, appInfo);
    } 
 
    @Override 
    public CharSequence getApplicationLabel(ApplicationInfo info) {
        return wrapped.getApplicationLabel(info);
    } 
 
    @Override 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
getText Method Overview
Retrieve text from a package.
See Code Examples for other Android PackageManager Methods: