am 0b1cfc1f: Merge "Docs: In the section "Determine if You Have an Internet Connection," I added to the code snippet so that it also checks whether activeNetwork is null. Bug: 10797360" into jb-mr2-docs

* commit '0b1cfc1fb64a1b24f107abf106eb839287f65cfb':
  Docs: In the section "Determine if You Have an Internet Connection," I added to the code snippet so that it also checks whether activeNetwork is null. Bug: 10797360
This commit is contained in:
David Friedman
2013-09-27 10:30:03 -07:00
committed by Android Git Automerger

View File

@@ -49,7 +49,8 @@ to query the active network and determine if it has Internet connectivity.</p>
(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
boolean isConnected = activeNetwork.isConnectedOrConnecting();</pre>
boolean isConnected = activeNetwork != null &&
activeNetwork.isConnectedOrConnecting();</pre>
<h2 id="DetermineType">Determine the Type of your Internet Connection</h2>