Java Code Examples for android.content.Intent#parseIntent()

The following examples show how to use android.content.Intent#parseIntent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AliasActivity.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private Intent parseAlias(XmlPullParser parser)
        throws XmlPullParserException, IOException {
    AttributeSet attrs = Xml.asAttributeSet(parser);
    
    Intent intent = null;
    
    int type;
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
            && type != XmlPullParser.START_TAG) {
    }
    
    String nodeName = parser.getName();
    if (!"alias".equals(nodeName)) {
        throw new RuntimeException(
                "Alias meta-data must start with <alias> tag; found"
                + nodeName + " at " + parser.getPositionDescription());
    }
    
    int outerDepth = parser.getDepth();
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
           && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
        if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
            continue;
        }

        nodeName = parser.getName();
        if ("intent".equals(nodeName)) {
            Intent gotIntent = Intent.parseIntent(getResources(), parser, attrs);
            if (intent == null) intent = gotIntent;
        } else {
            XmlUtils.skipCurrentTag(parser);
        }
    }
    
    return intent;
}