From 8ca6a095a358ec49695b00c239273bf6f3b1a2e6 Mon Sep 17 00:00:00 2001 From: David Friedman Date: Thu, 26 Sep 2013 17:19:43 -0700 Subject: 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 --- docs/html/training/monitoring-device-state/connectivity-monitoring.jd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs/html/training') 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.

(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); -boolean isConnected = activeNetwork.isConnectedOrConnecting(); +boolean isConnected = activeNetwork != null && + activeNetwork.isConnectedOrConnecting();

Determine the Type of your Internet Connection

-- cgit v1.1