[英]Java Android Illegal Argument exception
我正在執行以下代碼:
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(new HttpGet("(...)&avatarUrl={(...)}&socialId=1&sexo=m&username="));
我的問題是我從avatarUrl
單詞的字母l處收到了一個illegalArgumentException
的avatarUrl
,我不明白為什么。
非常感謝您的幫助。
除了問題?
奧德&
在你的代碼中,有簡潔的方式來傳遞參數:
HttpClient httpclient = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
BasicHttpParams params = new BasicHttpParams();
params.setParameter("avatarUrl","...")
.setParameter("socialId","...")
.setParameter("sexo","...")
.setParameter("username","...");
request.setParams(params);
HttpResponse response = httpclient.execute(request);
(未經測試,但應該可以工作)
注意:由於一些誤解,我對原始答案進行了大量編輯。
?
{
和}
對網址不是有效的字符 ,應將其轉義
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.