如何从输入流中获取字符串值?

时间:2014-10-08 14:54:03

标签: php android mysql

我有android应用程序,在android应用程序中我已经在mysql数据库表上执行了select查询。

HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost("http://www.mywebsite.com/select.php");
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs,HTTP.UTF_8));
            HttpResponse response = httpclient.execute(httppost); 
            HttpEntity entity = response.getEntity();
            InputStream is = entity.getContent();   
            //if(compare is value here)

这里我要查看InputStream is值。

当我在浏览器上执行http://www.mywebsite.com/select.php时,我获得的输出值如{name : ashu}null

但我如何比较这是我的代码,因为我无法检查is==null :(

1 个答案:

答案 0 :(得分:0)

您的清单文件中需要<uses-permission android:name="android.permission.INTERNET"/>