diff options
author | David Friedman <dmail@google.com> | 2013-09-26 17:19:43 -0700 |
---|---|---|
committer | David Friedman <dmail@google.com> | 2013-09-26 17:19:43 -0700 |
commit | 8ca6a095a358ec49695b00c239273bf6f3b1a2e6 (patch) | |
tree | b3df8794213c565de0e42658615e442e231cb927 /docs/html/training/monitoring-device-state | |
parent | a8f519ff9cb38e97db34f5a7bac95a9e09ed5ade (diff) | |
download | frameworks_base-8ca6a095a358ec49695b00c239273bf6f3b1a2e6.zip frameworks_base-8ca6a095a358ec49695b00c239273bf6f3b1a2e6.tar.gz frameworks_base-8ca6a095a358ec49695b00c239273bf6f3b1a2e6.tar.bz2 |
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
Change-Id: I95344c2200cad5efb6457a9cb8fcd0e87298dcda
Diffstat (limited to 'docs/html/training/monitoring-device-state')
-rw-r--r-- | docs/html/training/monitoring-device-state/connectivity-monitoring.jd | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/docs/html/training/monitoring-device-state/connectivity-monitoring.jd b/docs/html/training/monitoring-device-state/connectivity-monitoring.jd index 11a05e1..fb5096d 100644 --- a/docs/html/training/monitoring-device-state/connectivity-monitoring.jd +++ b/docs/html/training/monitoring-device-state/connectivity-monitoring.jd @@ -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> |