Last active
August 29, 2015 14:25
-
-
Save Andrewpk/b0ef2a755d37f582f6dc to your computer and use it in GitHub Desktop.
String + Uri.parse() vs Uri.parse().buildUpon(). I'm probably missing something, but why does Android 2.3 have problems with using Uri.parse().buildUpon() when every one of these methods has been around since api v1?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Works great on Android 4, and likely 3 but causes Android 2.3 to build a Uri | |
* with a string value of "geo:?q=" + zipCode | |
*/ | |
Uri geoUri = Uri.parse("geo:0,0?").buildUpon() | |
.appendQueryParameter("q", zipCode).build(); | |
/** | |
* Works great on Android 2.3+ | |
*/ | |
String fullUri = "geo:0,0?q=" + zipCode; | |
Uri geoUri = Uri.parse(fullUri).buildUpon().build(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment