ProgressDialog does not exit 0%

0

I'm uploading an image to the firebase database and I want to show it in progress but it always gets 0/100.

 progress=new ProgressDialog(getContext());
    progress.setMessage("Downloading Music");
    progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progress.setIndeterminate(true);



   progress.show();
    uploadTask.addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
        @Override
        public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
            double p = (100.0 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount();
          int currentprogress = (int) p;
            progress.setProgress(currentprogress);

            if(currentprogress==100){
                progress.dismiss();
            }
        }
    });
    
asked by anonymous 10.03.2017 / 18:55

1 answer

0

progress.setIndeterminate (true); causes it to not measure progress. Change to false that should resolve.

    
12.03.2017 / 13:56