task.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
imageurl=taskSnapshot.getMetadata().getDownloadUrl().toString();
}
});
我想在将对象发布到数据库时在这里使用它:
PostAd pa= new PostAd(auth.getUid(),imageurl,timeStamp);
String id = db.child("Ads").push().getKey();
db.child("Ads").child(id).setValue(pa).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
dialog.dismiss();
Toast.makeText(getActivity(),"Ad posted succefully",Toast.LENGTH_LONG).show();
Title.setText(null);
}
});