如何将此HttpPost转换为Url

时间:2014-04-11 17:43:21

标签: android url http-post

我有以下代码,我想将其转换为一个简单的单个URL,以便(可能)我可以使用Picasso下载图像:

HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(Constants.GET_OTHER_PROFILE_PICTURE_URL);
nameValuePairs.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
UrlEncodedFormEntity form = new UrlEncodedFormEntity(nameValuePairs);
httppost.setEntity(form);

1 个答案:

答案 0 :(得分:1)

使用GET请求可以在URL中声明参数,如

<url>?<entry.getKey>=<entry.getValue>

相同的参数(由冒号分隔的键值对)通过正文传递给POST请求。