我在Link中使用Volley Library填充我的ListView
"http://192.168.***.***/allquestions/prev_ans.php/?number="+phone_number+"&&query="+query"
假设查询“问题更改”的Json数组是
[{"Name":"AAAAA","Id":"101010101","ques":"question change","Type":"class1","relatedFields":"Eduation","Name":"hshsusu","ans":"new answer 1","replyDate":"2015-09-14","replyTime":"21:05:39"}]
和查询“newquestionforcrop”的JSON数组是
[{"Name":"AAAAA","Id":"101010101","ques":"question change","Type":"class1","relatedFields":"Eduation","Name":"hshsusu","ans":"new answer 1","replyDate":"2015-09-14","replyTime":"21:05:39"}]
问题是,当我的查询之间没有空格时,它只会填充列表。
我该如何解决这个问题?
答案 0 :(得分:5)
您的网址应该被编码,因为空格不能在其中使用,并且必须由%20替换。
您应该使用类似:query = URLEncoder.encode(query, "utf-8");