import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
class Main {
public static boolean checkInternet(Context ctx) {
NetworkInfo info = (NetworkInfo) ((ConnectivityManager) ctx
.getSystemService(Context.CONNECTIVITY_SERVICE))
.getActiveNetworkInfo();
if (info == null || !info.isConnected())
return false;
if (info.isRoaming())
return false;
return true;
}
}