The first snippet won't append the 'locationQuery' paramenter, but the second one will, why the difference?
First snippet:
Uri builtUri = Uri.parse(FORECAST_BASE_URL);
builtUri.buildUpon()
.appendQueryParameter(QUERY_PARAM, locationQuery)
.build();
Second snippet (From udacity course github ):
Uri builtUri = Uri.parse(FORECAST_BASE_URL).buildUpon()
.appendQueryParameter(QUERY_PARAM, locationQuery)
.build();
Because you are not assigning Uri created with below expression
builtUri.buildUpon()
.appendQueryParameter(QUERY_PARAM, locationQuery)
.build();
Change it to
builtUri = builtUri.buildUpon()
.appendQueryParameter(QUERY_PARAM, locationQuery)
.build();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.