RingProgressBar icon indicating copy to clipboard operation
RingProgressBar copied to clipboard

Progress on download file

Open crysan opened this issue 8 years ago • 3 comments

Hi! I'm trying to do in RecyclerView progress display when copying files. But it displays only the last one (100%) results.

                try {
                    InputStream input = null;
                    OutputStream output = null;
                    long lenghtOfFile = source.length();
                    int count;
                    try {
                        input = new FileInputStream(source);
                        output = new FileOutputStream(destination);
                        byte[] data = new byte[1024];
                        long total  = 0;
                        while ((count = input.read(data)) != -1) {
                            total += count;
                            int xc = (int) ((total * 100) / lenghtOfFile);
                            holder.progress_bar.setProgress(xc);
                        }
                    } finally {
                        output.flush();
                        output.close();
                        input.close();
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }

Why are not the intermediate values?

crysan avatar Dec 12 '16 03:12 crysan

This item should be caused by reuse progress bar is not normal! @crysan

HotBitmapGG avatar Feb 28 '17 09:02 HotBitmapGG

I've already figured out. Thank you! It is a pity that the answer for so long ((

crysan avatar Feb 28 '17 23:02 crysan

@crysan I'm sorry, because too busy working on my side, there has been no time to maintain the project

HotBitmapGG avatar Mar 01 '17 00:03 HotBitmapGG