diff --git a/src/api-impl/android/content/res/AssetManager.java b/src/api-impl/android/content/res/AssetManager.java index fef78db6..37ad2e7d 100644 --- a/src/api-impl/android/content/res/AssetManager.java +++ b/src/api-impl/android/content/res/AssetManager.java @@ -494,6 +494,9 @@ public final class AssetManager { return rp;*/ InputStream inStream = ClassLoader.getSystemClassLoader().getResourceAsStream(fileName); + if (inStream == null) { + return null; + } ResXmlDocument resXmlDocument = new ResXmlDocument(); resXmlDocument.readBytes(inStream); ResXmlPullParser xpp = new ResXmlPullParser(); diff --git a/src/api-impl/android/view/LayoutInflater.java b/src/api-impl/android/view/LayoutInflater.java index 00941ae3..a0b383cc 100644 --- a/src/api-impl/android/view/LayoutInflater.java +++ b/src/api-impl/android/view/LayoutInflater.java @@ -188,11 +188,10 @@ public class LayoutInflater { throw new Exception(" not supported atm"); // parseRequestFocus(parser, parent); } else if (name.equals("include")) { - throw new Exception(" not supported atm"); - /*if (parser.getDepth() == 0) { + if (parser.getDepth() == 0) { throw new Exception(" cannot be the root element"); } - parseInclude(parser, parent, attrs);*/ + parseInclude(parser, parent, attrs); } else if (name.equals("merge")) { throw new Exception(" must be the root element"); } else if (name.equals("blink")) { @@ -214,4 +213,15 @@ public class LayoutInflater { if (finishInflate) parent.onFinishInflate(); } + + private void parseInclude(XmlPullParser parser, View parent, AttributeSet attrs) throws Exception { + int layout = attrs.getAttributeResourceValue(null, "layout", 0); + View view = inflate(layout, (ViewGroup)parent, true); + if (view == null) + return; + + int id = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "id", 0); + if (id != 0) + view.setId(id); + } }