Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如果为空,请检查webservice_Android - Fatal编程技术网

Android 如果为空,请检查webservice

Android 如果为空,请检查webservice,android,Android,我有一个网络服务,我想知道它是否是空的?? 我想知道怎么做。。如何发送请求并在文本视图中打印响应?? 我知道必须使用HttpConnetion 但是我对这门课感到困惑 DefaultHttpClient httpClient=新的DefaultHttpClient(); HttpGet-httpPost=新的HttpGet(urlName) 返回真值?getAttributeCount返回一个int!是的,我知道,但是我使用了一个条件,如果返回0 setText True,那么getProper

我有一个网络服务,我想知道它是否是空的?? 我想知道怎么做。。如何发送请求并在文本视图中打印响应?? 我知道必须使用
HttpConnetion

但是我对这门课感到困惑

DefaultHttpClient httpClient=新的DefaultHttpClient(); HttpGet-httpPost=新的HttpGet(urlName)


返回真值?getAttributeCount返回一个int!是的,我知道,但是我使用了一个条件,如果返回0 setText True,那么getPropertyCount()呢?没有在xmlPullParser中定义!!我如何使用它??@mihail
       HttpResponse httpResponse = httpClient.execute(httpPost);
       HttpEntity httpEntity = httpResponse.getEntity();
       inputStream = httpEntity.getContent(); 




       BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 8);
       StringBuilder stringBuilder = new StringBuilder();
       String line = null;
       if ((line = reader.readLine()) != null) {
       stringBuilder.append(line + "\n");
       Data.servContent=stringBuilder.toString();
       }

       line = reader.readLine();
       inputStream.close();
      } catch (UnsupportedEncodingException e) {
           System.err.print("UnsupportedEncodingException: " + e);
       } catch (ClientProtocolException e) {
       System.err.print("ClientProtocolException: " + e);
       } catch (IOException e) {
       System.err.print("IOException: " + e);
       } catch (Exception e) {
       Log.e("Buffer Error", "Error converting result " + e.toString());
       }