Code example for NetworkInfo

Methods: getState

        ConnectivityManager manager = (ConnectivityManager)
        NetworkInfo info = manager.getActiveNetworkInfo();
        if (info == null)
            return false; 
        if (info.getState() != State.CONNECTED)
            return false; 
        return true; 
    /** Fetch the image specified by the given url */ 
    public static Bitmap fetchImage(URL url) throws IOException {
        InputStream is = null;
        try { 
            URLConnection conn = url.openConnection();
            is = conn.getInputStream();
            BufferedInputStream bis = new BufferedInputStream(is, 16384);
            try { 
                Bitmap bitmap = BitmapFactory.decodeStream(bis);
Stop searching for code, let great code find you!  Add Codota to your java IDE