In-app image was selected but when I click to upload on the firebase button that time this error came???
select image button:
public void uploadImage(){
StorageReference storageReference = FirebaseStorage.getInstance ()
.getReference ().child ( "ProductImage" ).child ( uri.getLastPathSegment () );
storageReference.putFile ( uri ).addOnSuccessListener ( new OnSuccessListener <UploadTask.TaskSnapshot> ( ) {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Task <Uri> uriTask = taskSnapshot.getStorage().getDownloadUrl();
//Error comes on this line in a while- loop code.
while(!uriTask.isComplete ());
Uri urlImage = uriTask.getResult ();
imageUrl = urlImage.toString ();[![enter image description here][1]][1]
}
} ).addOnFailureListener ( new OnFailureListener ( ) {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText ( Add.this, e.getMessage (), Toast.LENGTH_SHORT ).show ( );
}
} );
}