Reading file chunk by chunk

See InputSteram.read(byte[]) for reading bytes at a time. Example code: try { File file = new File(“myFile”); FileInputStream is = new FileInputStream(file); byte[] chunk = new byte[1024]; int chunkLen = 0; while ((chunkLen = is.read(chunk)) != -1) { // your code.. } } catch (FileNotFoundException fnfE) { // file not found, handle case } catch … Read more

Android download PDF from URL then open it with a PDF reader

Hi the problem is in FileDownloader class urlConnection.setRequestMethod(“GET”); urlConnection.setDoOutput(true); You need to remove the above two lines and everything will work fine. Please mark the question as answered if it is working as expected. Latest solution for the same problem is updated Android PDF Write / Read using Android 9 (API level 28) Attaching the … Read more