이 코드를 사용하여 Reddit에서 json 데이터를 다운로드하고 있습니다. 코드는 내가 만든 테스트 자바 프로젝트에서 작동하지만 안드로이드 장치에서 사용할 때는 그렇지 않습니다. 안드로이드 장치에서는 json 데이터의 일부만 다운로드합니다. 나는 이유를 알 수 없다. 어떤 도움을 주셔서 감사합니다.Android aynctask json
@Override
protected JSONObject doInBackground(URL... urls) {
String c;
StringBuilder str = new StringBuilder();
try {
BufferedReader in = new BufferedReader(new InputStreamReader((InputStream) urls[0].getContent()));
while((c = in.readLine()) != null) {
str.append(c);
}
in.close();
json = new JSONObject(str.toString());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return json;
}
오류를 찾으셨습니까? – Vinay
좀 더 구체적으로 기재 할 수 있습니까? 어떤 오류가 있습니까? 데이터의 일부분을 어떻게 알았습니까? – jaga
@JJPA 오류가 없습니다. –