Java tutorial
//package com.java2s; import android.content.Context; import android.net.ConnectivityManager; public class Main { public static boolean isOpenNetwork(Context con) { ConnectivityManager connManager = (ConnectivityManager) con.getSystemService(Context.CONNECTIVITY_SERVICE); if (connManager.getActiveNetworkInfo() != null) { return connManager.getActiveNetworkInfo().isAvailable(); } return false; } }