Any idea on how to return a second value in this code?
private void uploadImage_10() {
final ProgressDialog pd = new ProgressDialog(this);
pd.setMessage("Posting");
pd.show();
if (mImageUri != null&&mImageUri2 != null){
final StorageReference fileReference = storageRef.child(System.currentTimeMillis()
+ "." + getFileExtension(mImageUri));
final StorageReference fileReference2 = storageRef.child(System.currentTimeMillis()
+ "." + getFileExtension(mImageUri2));
uploadTask2 = fileReference2.putFile(mImageUri2);
uploadTask = fileReference.putFile(mImageUri);
uploadTask.continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() {
@Override
public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {
if (!task.isSuccessful()) {
throw task.getException();
}
return fileReference.getDownloadUrl();
}
}).addOnCompleteListener(new OnCompleteListener<Uri>() {
@Override
public void onComplete(@NonNull Task<Uri> task) {
if (task.isSuccessful()) {
Uri downloadUri = task.getResult();
miUrlOk = downloadUri.toString();
Uri downloadUri2 = task.getResult();
miUrlOk2 = downloadUri2.toString();
DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Posts");
String postid = reference.push().getKey();
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("postid", postid);
hashMap.put("postimage", miUrlOk);
hashMap.put("postimage2", miUrlOk2);
hashMap.put("description", description.getText().toString());
hashMap.put("publisher", FirebaseAuth.getInstance().getCurrentUser().getUid());
I want to return fileReference.getDownloadUrl(); and fileReference2.getDownloadUrl(); but have no idea how.