【发布时间】:2014-10-13 19:15:44
【问题描述】:
我正在尝试构建一个字符串/URI 来访问 API。 API 接受一个句子参数。现在我这样做的尝试如下:
//params[0] is a String such as "You will be a hero"
Uri.Builder builder = new Uri.Builder();
builder.scheme("https").authority("yoda.p.mashape.com/yoda").appendQueryParameter("sentence", params[0]);
Log.v("STRING TEST", builder.build().toString());
这只是我最好的尝试,并没有按我的意愿工作。这当前输出:
https://yoda.p.mashape.com%2Fyoda?sentence=you%20will%20be%20a%20hero
我正在寻找一种方法来构建如下所示的 URI:
https://yoda.p.mashape.com/yoda?sentence=you+will+be+a+hero
任何帮助将不胜感激。非常感谢!
【问题讨论】:
标签: android uri uribuilder