Android HTTPRequest循环

Android HTTPRequest循环,android,json,httpclient,http-post,Android,Json,Httpclient,Http Post,我试图将JSON发送到我的服务器,并作为结果检索JSON。 比如发送用户名和密码,取回令牌和其他内容 这就是我对HTTP发送请求所做的。现在如何检索同一请求中的内容 HttpClient client = new DefaultHttpClient(); HttpPost request = new HttpPost("http://192.168.1.5/temp/test.php"); List<NameValuePair> v

我试图将JSON发送到我的服务器,并作为结果检索JSON。 比如发送用户名和密码,取回令牌和其他内容

这就是我对HTTP发送请求所做的。现在如何检索同一请求中的内容

        HttpClient client = new DefaultHttpClient();

        HttpPost request = new HttpPost("http://192.168.1.5/temp/test.php");

        List<NameValuePair> value = new ArrayList<NameValuePair>();

        value.add(new BasicNameValuePair("Name", jsonStr));

        UrlEncodedFormEntity entity = new UrlEncodedFormEntity(value);

        request.setEntity(entity);

        HttpResponse res = client.execute(request);

        String[] status_String=res.getStatusLine().toString().trim().split(" ");
        //String hd=res.getFirstHeader("result").toString();

        //System.out.println("Res=" + res);
        Log.e("tag", ""+res.toString());
        if(status_String[1].equals("200")){
            isDataSent=true;
HttpClient=newdefaulthttpclient();
HttpPost请求=新建HttpPost(“http://192.168.1.5/temp/test.php");
列表值=新的ArrayList();
add(新的BasicNameValuePair(“Name”,jsonStr));
UrlEncodedFormEntity实体=新的UrlEncodedFormEntity(值);
请求。设置实体(实体);
HttpResponse res=client.execute(请求);
String[]status_String=res.getStatusLine().toString().trim().split(“”);
//字符串hd=res.getFirstHeader(“结果”).toString();
//System.out.println(“Res=“+Res”);
Log.e(“tag”,“res.toString());
if(状态_字符串[1]。等于(“200”)){
isDataSent=true;
您可以使用


让我在vvieux的回答中添加更多内容:

res.getEntity().getContent() 
将返回您的InputStream

res.getEntity().getContent() 
res.getEntity().getContent()