diff options
Diffstat (limited to 'core/java/com')
-rw-r--r-- | core/java/com/android/internal/util/XmlUtils.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/com/android/internal/util/XmlUtils.java b/core/java/com/android/internal/util/XmlUtils.java index f40f48c..0b74cf3 100644 --- a/core/java/com/android/internal/util/XmlUtils.java +++ b/core/java/com/android/internal/util/XmlUtils.java @@ -931,6 +931,15 @@ public class XmlUtils { out.attribute(null, name, Integer.toString(value)); } + public static long readLongAttribute(XmlPullParser in, String name, long defaultValue) { + final String value = in.getAttributeValue(null, name); + try { + return Long.parseLong(value); + } catch (NumberFormatException e) { + return defaultValue; + } + } + public static long readLongAttribute(XmlPullParser in, String name) throws IOException { final String value = in.getAttributeValue(null, name); try { |