Use this code. This will work
public static boolean chkInternetConnection(Context cxt) {
boolean isAvailable = false;
ConnectivityManager conMgr = (ConnectivityManager)
cxt.getSystemService(Context.CONNECTIVITY_SERVICE);
if (conMgr.getActiveNetworkInfo() != null
&& conMgr.getActiveNetworkInfo().isAvailable()
&& conMgr.getActiveNetworkInfo().isConnected()) {
isAvailable =true;
} else {
isAvailable = false;
}
return isAvailable ;
}
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en