Here you can find the source of optFloatAttr(final XmlPullParser pp, final String attrName, final float defaultValue)
public static double optFloatAttr(final XmlPullParser pp, final String attrName, final float defaultValue)
//package com.java2s; /*// ww w.j a v a 2 s. com * For license please see accompanying LICENSE.txt file (available also at http://www.xmlpull.org/). * According to www.xmlpull.org, this code is in the public domain. */ import org.xmlpull.v1.XmlPullParser; public class Main { public static double optFloatAttr(final XmlPullParser pp, final String attrName, final float defaultValue) { final String attr = optAttr(pp, attrName, null); if (attr != null) return Double.parseDouble(attr); else return defaultValue; } public static String optAttr(final XmlPullParser pp, final String attrName, final String defaultValue) { final String attr = pp.getAttributeValue(null, attrName); if (attr != null) { final String trimmedAttr = attr.trim(); if (trimmedAttr.length() > 0) return trimmedAttr; } return defaultValue; } }