Code example for XmlPullParser

Methods: getAttributeValue

0
        } 
    } 
 
    private int getIntAttribute(XmlPullParser parser, String name) {
        try { 
            String str = parser.getAttributeValue(null, name);
            return str != null ? Integer.parseInt(str) : 0;
        } catch (NumberFormatException e) {
            return 0; 
        } 
    } 
 
    private void readDisplay(XmlPullParser parser) throws NumberFormatException,
            XmlPullParserException, IOException { 
        String name = parser.getAttributeValue(null, "name");
        if (name != null) {
            Entry entry = new Entry(name);
            entry.overscanLeft = getIntAttribute(parser, "overscanLeft");
            entry.overscanTop = getIntAttribute(parser, "overscanTop");
            entry.overscanRight = getIntAttribute(parser, "overscanRight");
            entry.overscanBottom = getIntAttribute(parser, "overscanBottom");