Search in sources :

Example 1 with XmlBlock

use of org.robolectric.res.builder.XmlBlock in project robolectric by robolectric.

the class ShadowAssetManager method loadXmlResourceParser.

public XmlResourceParser loadXmlResourceParser(int resId, String type) throws Resources.NotFoundException {
    ResName resName = getResName(resId);
    ResName resolvedResName = resolveResName(resName, RuntimeEnvironment.getQualifiers());
    if (resolvedResName == null) {
        throw new RuntimeException("couldn't resolve " + resName.getFullyQualifiedName());
    }
    resName = resolvedResName;
    XmlBlock block = resourceTable.getXml(resName, RuntimeEnvironment.getQualifiers());
    if (block == null) {
        throw new Resources.NotFoundException(resName.getFullyQualifiedName());
    }
    ResourceTable resourceProvider = ResourceIds.isFrameworkResource(resId) ? RuntimeEnvironment.getSystemResourceTable() : RuntimeEnvironment.getCompileTimeResourceTable();
    return getXmlResourceParser(resourceProvider, block, resName.packageName);
}
Also used : XmlBlock(org.robolectric.res.builder.XmlBlock) ResName(org.robolectric.res.ResName) ResourceTable(org.robolectric.res.ResourceTable)

Aggregations

ResName (org.robolectric.res.ResName)1 ResourceTable (org.robolectric.res.ResourceTable)1 XmlBlock (org.robolectric.res.builder.XmlBlock)1