You need to add listeners when retrieving the url.
Please read the documentations
taskSnapshot.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(Uri uri) {
// Got the uri
ImageUpload imageUpload = new ImageUpload(editText5.getText().toString(), uri.toString());
// Wrap with Uri.parse() when retrieving
String uploadId = mDatabaseRef.push().getKey();
mDatabaseRef.child(uploadId).setValue(imageUpload);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle any errors
}
});