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

This code example shows how to use the following methods:getDrawable
 
        // Use local package for resources when none requested 
        if (mResPackage == null) mResPackage = context.getPackageName();
 
        final boolean validIcon = mResPackage != null && mIconRes != -1;
        return validIcon ? pm.getDrawable(mResPackage, mIconRes, null) : null;
    } 
 
    private static String getString(Cursor cursor, String columnName) {
        return cursor.getString(cursor.getColumnIndex(columnName));
    } 
 
    private static int getInt(Cursor cursor, String columnName) {
        return cursor.getInt(cursor.getColumnIndex(columnName));
    } 
 
    private static int getInt(Cursor cursor, String columnName, int missingValue) {
        final int columnIndex = cursor.getColumnIndex(columnName);
        return cursor.isNull(columnIndex) ? missingValue : cursor.getInt(columnIndex);
    } 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getDrawable
 
        // Use local package for resources when none requested 
        if (mResPackage == null) mResPackage = context.getPackageName();
 
        final boolean validIcon = mResPackage != null && mIconRes != -1;
        return validIcon ? pm.getDrawable(mResPackage, mIconRes, null) : null;
    } 
 
    private static String getString(Cursor cursor, String columnName) {
        return cursor.getString(cursor.getColumnIndex(columnName));
    } 
 
    private static int getInt(Cursor cursor, String columnName) {
        return cursor.getInt(cursor.getColumnIndex(columnName));
    } 
 
    private static int getInt(Cursor cursor, String columnName, int missingValue) {
        final int columnIndex = cursor.getColumnIndex(columnName);
        return cursor.isNull(columnIndex) ? missingValue : cursor.getInt(columnIndex);
    } 
6
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: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
    } 
 
    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 { 
            return null; 
        } 
    } 
 
    abstract public int getHeaderColor(Context context);
 
    abstract public int getSideBarColor(Context context);
 
    /** 
     * {@link Comparator} to sort by {@link DataKind#weight}. 
     */ 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getDrawable
	} 
	 
	public Drawable getDrawableResource(String name) {
		if(remoteRes != null && pInfos != null) {
			int id = remoteRes.getIdentifier(name, "drawable", pInfos.packageName);
            return pm.getDrawable(pInfos.packageName, id, pInfos.applicationInfo);
		}else { 
			Log.d(THIS_FILE, "No results yet !! ");
		} 
		return null; 
	} 
 
    public Integer getDimension(String name) {
        if(remoteRes != null && pInfos != null) {
            int id = remoteRes.getIdentifier(name, "dimen", pInfos.packageName);
            if(id > 0) {
                return remoteRes.getDimensionPixelSize(id);
            } 
        }else { 
            Log.d(THIS_FILE, "No results yet !! ");
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getDrawable
        return wrapped.queryInstrumentation(targetPackage, flags);
    } 
 
    @Override 
    public Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo) {
        return wrapped.getDrawable(packageName, resid, appInfo);
    } 
 
    @Override 
    public Drawable getActivityIcon(ComponentName activityName)
    throws NameNotFoundException { 
        return wrapped.getActivityIcon(activityName);
    } 
 
    @Override 
    public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
        return wrapped.getActivityIcon(intent);
    } 
 
    @Override 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related PackageManager getDrawable Questions & Answers:

getDrawable Method Overview
Retrieve an image from a package.
See Code Examples for other Android PackageManager Methods: