我正在尝试从网址获取XML内容:
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet();
request.setURI(new URI("http://www.domain.com/test.aspx"));
HttpResponse response = client.execute(request);
in = response.getEntity().getContent();
当我写出回复内容时,会在内容结束之前将其截断。
有什么想法吗?
答案 0 :(得分:1)
您是否使用InputStreamReader
作为输入流in
?
String s = "";
String line = "";
BufferedReader rd = new BufferedReader(new InputStreamReader(in));
try {
while ((line = rd.readLine()) != null) { s += line; }
} catch (IOException e) {
// Handle error
}
// s should be the complete string
答案 1 :(得分:0)
也许我已经解决了,是android模拟器。只需重新启动它一切正常。
感谢所有