Java tutorial
//package com.java2s; //License from project: Open Source License import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Main { static public boolean isNetworkConnectionAvailable(ConnectivityManager connectivityManager) { NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); return null != networkInfo && networkInfo.isConnected(); } }