为什么下面的代码只返回一个“{”,即 JSON 字符串的开头而不是整个 JSON?当我在浏览器中输入 URL 时,它会返回完整的 JSON。我试图缓冲响应,但似乎没有任何效果?谁能解释为什么?
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet("https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Nasik%20&types=geocode&language=en&sensor=true&key=API-KEY");
HttpResponse response = httpclient.execute(httpget);
InputStream is = response.getEntity().getContent();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
Toast.makeText(this, br.readLine(), Toast.LENGTH_LONG).show();