public boolean isOnline() {
boolean var = false;
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if ( cm.getActiveNetworkInfo() != null ) {
var = true;
}
return var;
}
I have done it this way. A little bit shorter and more readable I guess.
Cheers!
Saiyan