• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Access large Json webservice in android

Hi,

I am new to android. I am using android 2.3 os. I'm trying consume the we service which is created in php and json. I am getting only the half of the json values when the json data is bigger and remaining values are truncated. I am using the following code.

HttpConnectionParams.setConnectionTimeout(httpParams,TIMEOUT_MILLISEC);
HttpConnectionParams.setSoTimeout(httpParams,TIMEOUT_MILLISEC);
HttpPost httppost = new HttpPost(url3);
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
httppost.setParams(httpParams);

HttpResponse response = httpclient.execute(httppost);

/* Checking response */
if (response != null) {
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8"));
StringBuilder builder = new StringBuilder();



for (String line = null; (line = reader.readLine()) != null;) {
builder.append(line).append("\n");
}


JSONTokener tokener = new JSONTokener(builder.toString());
JSONArray finalResult = new JSONArray(tokener);
JSONObject kiosk = finalResult.getJSONObject(0);

Log.w(TAG, finalResult.toString());
}
 
Back
Top Bottom