我有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
:(
答案 0 :(得分:0)
您的清单文件中需要<uses-permission android:name="android.permission.INTERNET"/>