我正在使用链接中的 Volley 库填充我的 ListView
"http://192.168.***.***/allquestions/prev_ans.php/?number="+phone_number+"&&query="+query"
假设,查询“question change”的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"}]
问题是,它只会在我的查询之间没有空格时填充列表。
我该如何解决?
最佳答案
您的网址应该进行编码,因为其中不能使用空格,必须用 %20 替换。
你应该使用类似这样的东西:query = URLEncoder.encode(query, "utf-8");
关于android - 如何发送包含空格的 JSON 查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32587369/