Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid web service response JSON with many Base64 String not working
    primarykey
    data
    text
    <p>In my project I call a URLusing HttpClient and get a JSON response with 15-20 Base64 String. The HttpClient Code is following.</p> <pre><code>public static JSONObject TestHttpPost(String url, List&lt;NameValuePair&gt; nameValuePairs) { long t = System.currentTimeMillis(); HttpClient client = new DefaultHttpClient(); Log.i(TAG, "HTTPResponse received in [" + (System.currentTimeMillis() - t) + "ms]"); HttpPost post = new HttpPost(url); try { post.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = client.execute(post); BufferedReader rd = new BufferedReader(new InputStreamReader( response.getEntity().getContent())); String resultString = convertStreamToString(rd); JSONObject jsonObjRecv = new JSONObject(resultString); Log.i(TAG, "&lt;JSONObject&gt;\n" + jsonObjRecv.toString() + "\n&lt;/JSONObject&gt;"); return jsonObjRecv; } catch (Exception e) { return null; } } private static String convertStreamToString(BufferedReader reader) { StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } } catch (IOException e) { e.printStackTrace(); } return sb.toString(); } </code></pre> <p>I am facing the following roblems</p> <ol> <li>When ever i process the response using convertStreamToString() , i am unable to get the whole response .</li> </ol> <p>2 As the Base64 string size is too big , StringBuilder is unable to store the whole images String . The function just return a small part of the JSON. And it wil take too much time to process.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload