title: check internet in android emulator
body: <p>i am trying to check internet connection in my android app </p>
  
  <pre><code>    public static boolean isConnectingToInternet(Context _context) {
      ConnectivityManager connectivity = (ConnectivityManager) _context
              .getSystemService(Context.CONNECTIVITY_SERVICE);
      if (connectivity != null) {
          NetworkInfo[] info = connectivity.getAllNetworkInfo();
          if (info != null)
              for (int i = 0; i &lt; info.length; i++)
                  if (info[i].getState() == NetworkInfo.State.CONNECTED) {
                      Log.d("Network",
                              "NETWORKnAME: " + info[i].getTypeName());
                      return true;
                  }
  
      }
      return false;
  }
  </code></pre>
  
  <p>but problem is that when i try to check internet connection in emulator by turning off host PC internet connection still this function returning true that is internet available while i have turn off internet connection from host PC<br>
   <code>ConnectivityManager</code> class  help in determining whether connected with the network not about the internet connectivity</p>
  
  <p>my question is how to check internet connection is not available ?</p>