XmlPullParser parser = Xml.newPullParser();
try {
parser.setInput(in, "UTF-8");
int eventType = parser.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) {
if (eventType == XmlPullParser.START_TAG && parser.getName().equals("card")) {
BluetoothPbapCard card = new BluetoothPbapCard(
parser.getAttributeValue(null, "handle"),
parser.getAttributeValue(null, "name"));
mCards.add(card);
}
eventType = parser.next();
}
} catch (XmlPullParserException e) {
Log.e(TAG, "XML parser error when parsing XML", e);
}