title: Check network available in android
body: <p>I have to develop one android application.</p>
  
  <p>Here i have to develop one twitter integration android application.</p>
  
  <p>i have using below code:</p>
  
  <pre><code>public void onClickTwitt() {
      if (isNetworkAvailable()) {
          Twitt twitt = new Twitt(getActivity(), consumer_key, secret_key);
          twitt.shareToTwitter(_Title);
      } else {
          showToast("No Network Connection Available !!!");
      }
  }
  public boolean isNetworkAvailable() {
       ConnectivityManager connectivity =(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
  
      if (connectivity == null) {
          return false;
      } else {
          NetworkInfo[] info = connectivity.getAllNetworkInfo();
          if (info != null) {
              for (int i = 0; i &lt; info.length; i++) {
                  if (info[i].getState() == NetworkInfo.State.CONNECTED) {
                      return true;
                  }
              }
          }
      }
      return false;
  }
  </code></pre>
  
  <p>Here am getting below error :</p>
  
  <pre><code>The method getSystemService(String) is undefined for the type 
   SubCate
  </code></pre>
  
  <p>Please help me...How can i resolve these error ????</p>