diff --git a/api/current.xml b/api/current.xml index a944213cc79d4..3d8375ff30e95 100644 --- a/api/current.xml +++ b/api/current.xml @@ -61923,6 +61923,21 @@ + + + + + + + + + + + + - - { throw new UnsupportedOperationException(NOT_HIERARCHICAL); } if (key == null) { - throw new NullPointerException("key"); + throw new NullPointerException("key"); } final String query = getEncodedQuery(); @@ -1608,6 +1608,24 @@ public abstract class Uri implements Parcelable, Comparable { return null; } + /** + * Searches the query string for the first value with the given key and interprets it + * as a boolean value. "false" and "0" are interpreted as false, everything + * else is interpreted as true. + * + * @param key which will be decoded + * @param defaultValue the default value to return if there is no query parameter for key + * @return the boolean interpretation of the query parameter key + */ + public boolean getBooleanQueryParameter(String key, boolean defaultValue) { + String flag = getQueryParameter(key); + if (flag == null) { + return defaultValue; + } + flag = flag.toLowerCase(); + return (!"false".equals(flag) && !"0".equals(flag)); + } + /** Identifies a null parcelled Uri. */ private static final int NULL_TYPE_ID = 0;