Code example for NetworkErrorException

0
 
        /* 
         * check net work 
         */ 
        if (!NetworkUtils.isNetworkAvailable(mContext)) {
            throw new NetworkErrorException("Network blocked.");
        } 
 
        /* 
         * check file length 
         */ 
        String userAgent = NetworkUtils.getUserAgent(mContext);
        mConnection = (HttpURLConnection) mURL.openConnection();
        mConnection.setRequestMethod("GET");
        mConnection.setRequestProperty("User-Agent", userAgent);
        mConnection.setRequestProperty("Accept-Encoding", "identity");
        if (mTempFile.exists()) {
            mPreviousFileSize = mTempFile.length();
            mConnection.setRequestProperty("Range", "bytes=" + mPreviousFileSize + "-");
        } 
Stop searching for code, let great code find you!  Add Codota to your java IDE