title: Show Upload Percentage while Uploading Image to Firebase
body: <p>I am Trying to Upload Image into Firebase and want to see the Upload Percentage during upload....Here my code:-</p>
  
  <pre><code>StorageReference storageReference = FirebaseStorage.getInstance().getReference().child("Chat_Images");
  StorageReference filepath = storageReference.child(ImageURI.getLastPathSegment());
  
  final String path = filepath.getPath();
  
  
  filepath.putFile(ImageURI).addOnProgressListener(new OnProgressListener&lt;UploadTask.TaskSnapshot&gt;() {
      @Override
      public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
  
          double progress = (100.0 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount();
          //System.out.println("Upload is " + progress + "% done");
          int currentprogress = (int) progress;
          Toast.makeText(CHATmainACTIVITY.this, "Upload "+currentprogress, Toast.LENGTH_SHORT).show();
  
      }
  }).addOnPausedListener(new OnPausedListener&lt;UploadTask.TaskSnapshot&gt;() {
      @Override
      public void onPaused(UploadTask.TaskSnapshot taskSnapshot) {
          TastyToast.makeText(CHATmainACTIVITY.this, "Upload Has Stopped Due to Network Error..", TastyToast.LENGTH_SHORT,TastyToast.ERROR).show();
      }
  }).addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {
      @Override
      public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
          DatabaseReference message_roottemp = imageref.child(temp_key);
          String downloadURI2= taskSnapshot.getDownloadUrl().toString();
          Map&lt;String, Object&gt; map2 = new HashMap&lt;String, Object&gt;();
          map2.put("Text", "");
          map2.put("sender_name", current_user.replace("@zumi.com", ""));
          map2.put("sender_photo", downloadURI2);
          map2.put("timestamp", mydate);
          map2.put("message_status", "Saved");
          map2.put("msg_type", "IMAGE");
          message_roottemp.updateChildren(map2);
      }
  }).addOnFailureListener(new OnFailureListener() {
      @Override
      public void onFailure(@NonNull Exception e) {
          TastyToast.makeText(CHATmainACTIVITY.this, "Upload Has Stopped Due to Network Error..", TastyToast.LENGTH_SHORT,TastyToast.ERROR).show();
  
      }
  });
  </code></pre>
  
  <p>The Code Shows 0 and Then Directly 100% ...in the Toast ..</p>