public static boolean isConnected(NetType netType,NetworkInfo networkInfo){
  if (netType == NetType.Any && networkInfo != null && isConnected(networkInfo))   return true;
 else   if (netType == NetType.Wifi && networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_WIFI && isConnected(networkInfo))   return true;
 else   if (netType == NetType.Mobile && networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_MOBILE && isConnected(networkInfo))   return true;
  return false;
}

public static boolean isConnected ( NetType netType , NetworkInfo networkInfo ) { if ( netType == NetType . Any && networkInfo != null && isConnected ( networkInfo ) ) return true ; else if ( netType == NetType . Wifi && networkInfo != null && networkInfo . getType ( ) == ConnectivityManager . TYPE_WIFI && isConnected ( networkInfo ) ) return true ; else if ( netType == NetType . Mobile && networkInfo != null && networkInfo . getType ( ) == ConnectivityManager . TYPE_MOBILE && isConnected ( networkInfo ) ) return true ; return false ; }
according to the different type of network to determine whether the network connection .
