filepath.putFile(mImageUri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(final UploadTask.TaskSnapshot taskSnapshot) {
final Uri downloadUrl =taskSnapshot.getStorage().getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
Toast.makeText(getBaseContext(), "Upload success! URL - " + downloadUrl.toString() , Toast.LENGTH_SHORT).show();
}
});
这是我的代码的一部分,实际上ins中的onSuccess(Uri uri)方法内部有错误
downloadUrl.toString()
并且错误很明显downloadUrl
可能尚未初始化