I assume you refer
NetworkUtil in this github, it is not part of Android SDK;
ConnectivityManager is (Added in API Level 1, i.e. from the very beginning of Android SDK).
Always use Android SDK functions instead of 3rd party libraries if possible, as there will be better support, and compatible with future Android OS.
In short, use
ConnectivityManager until it is deprecated.