웹에서 JSON 문자열을 가져 오기 위해 HttpUrlConnection을 사용하고 있지만 응답은 작은 문자열에는 적합하지만 큰 문자열에는 적합하지 않습니다. this은 내 응용 프로그램에서 볼 수있는 것이며, this은 서버의 데이터입니다. 웹 페이지 나는 서버 측에서 HTML을 포함하지 않았다.최대 HttpUrlConnection 응답
여기 내 코드입니다 :
URL adr = new URL("http://placeform.tk/forapp.php");
HttpURLConnection connection =(HttpURLConnection) adr.openConnection();
connection.connect();
int rcode = connection.getResponseCode();
Log.d("rcode",Integer.toString(rcode));
if (rcode == HttpURLConnection.HTTP_OK) {
InputStream inputStreamReader = connection.getInputStream();
String c = connection.getHeaderField("content-length");
Reader rd = new InputStreamReader(inputStreamReader);
Log.d("contentsize", Integer.toString(connection.getContentLength()) + c);
chars = new char[connection.getContentLength()];
Log.d("contentsize", Integer.toString((int)connection.getContentLength()) + c);
rd.read(chars);
String output = new String(chars);
json을 구문 분석하는 코드를 넣으십시오. – uguboz
아직 그 부분을 수행하지는 않았지만, 로그를 사용하여 연결의 응답을 확인하면 ,,, logcat에서 읽었습니다 (http : // pastebin). co.kr/NRU7nGXV /) @ UğurB –