您好,我现在尝试了2天,我找不到从firebase获取下载网址的方法。但是,它没有提供图片网址,而是com.google.android.gms.tasks.zzu@d7f1843
这是我的代码 Uri resultUri = result.getUri();
String current_user_id = CurrentUser.getUid();
final StorageReference filepath = ImageStorage.child("profile_images").child(current_user_id +"jpg");
filepath.putFile(resultUri).addOnCompleteListener(new OnCompleteListener<UploadTask.TaskSnapshot>() {
@Override
public void onComplete(@NonNull Task<UploadTask.TaskSnapshot> task) {
if(task.isSuccessful()){
downloadImageUrl = filepath.getDownloadUrl().toString();
UserDatabase.child("image").setValue(downloadImageUrl).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful()){
ProgressDialog.dismiss();
Toast.makeText(SettingsActivity.this, "Success",Toast.LENGTH_LONG).show();
}
}
});
}else{
Toast.makeText(SettingsActivity.this, "Nope",Toast.LENGTH_LONG).show();
ProgressDialog.dismiss();
}
}
});
} else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
Exception error = result.getError();
}
}
}