在以下行中download_uri = task.getResult()。getDownloadUrl();, getDownloadUrl();显示错误。请帮助我解决此错误。
private void storeData(Task<UploadTask.TaskSnapshot> task, String username, String userfullname, String usercountry) {
Uri download_uri;
if (task != null) {
download_uri = task.getResult().getDownloadUrl();
} else {
download_uri = imageUri;
}
Map<String, String> userData = new HashMap<>();
userData.put("userName",username);
userData.put("userFullname",userfullname);
userData.put("userCountry",usercountry);
userData.put("profileImage",download_uri.toString());
firebaseFirestore.collection("Users").document(user_id).set(userData).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
progressDialog.dismiss();
Toast.makeText(SetupActivity.this, "User Data is Stored Successfully", Toast.LENGTH_LONG).show();
Intent mainIntent = new Intent(SetupActivity.this, HomeActivity.class);
startActivity(mainIntent);
finish();
} else {
String error = task.getException().getMessage();
Toast.makeText(SetupActivity.this, "(Error occurred) : " + error, Toast.LENGTH_LONG).show();
}
progressDialog.dismiss();
}
});
}