FileDocCategorySizeDatePackage
AttributeCache.javaAPI DocAndroid 1.5 API4091Wed May 06 22:42:00 BST 2009com.android.server

AttributeCache

public final class AttributeCache extends android.content.BroadcastReceiver

Fields Summary
private static AttributeCache
sInstance
private final android.content.Context
mContext
private final WeakHashMap
mMap
private final WeakHashMap
mContexts
Constructors Summary
public AttributeCache(android.content.Context context)

        mContext = context;
    
Methods Summary
public com.android.server.AttributeCache$Entryget(java.lang.String packageName, int resId, int[] styleable)

        synchronized (this) {
            Key key = new Key(packageName, resId, styleable);
            Entry ent = mMap.get(key);
            if (ent != null) {
                return ent;
            }
            Context context = mContexts.get(packageName);
            if (context == null) {
                try {
                    context = mContext.createPackageContext(packageName, 0);
                    if (context == null) {
                        return null;
                    }
                    mContexts.put(packageName, context);
                } catch (PackageManager.NameNotFoundException e) {
                    return null;
                }
            }
            try {
                ent = new Entry(context,
                        context.obtainStyledAttributes(resId, styleable));
                mMap.put(key, ent);
            } catch (Resources.NotFoundException e) {
                return null;
            }
            return ent;
        }
    
public static voidinit(android.content.Context context)

        if (sInstance == null) {
            sInstance = new AttributeCache(context);
        }
    
public static com.android.server.AttributeCacheinstance()

        return sInstance;
    
public voidonReceive(android.content.Context context, android.content.Intent intent)