HttpUrlConnectionを使用してWebからJSON文字列を取得していますが、レスポンスは小さい文字列には適していますが、大きい文字列では役に立ちません。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。 com/NRU7nGXV /)@UğurB –