Android examples for Network:HTTP Response
get Json String from HttpResponse
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String getJsonString(org.apache.http.HttpResponse response) { InputStream is = null;//from w w w.j a v a 2 s .c om StringBuilder sb = null; try { is = response.getEntity().getContent(); BufferedReader reader = new BufferedReader( new InputStreamReader(is)); sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } return sb.toString(); } }