【问题标题】:Android, Picasso, Firebase Storage - Retrieve Image, Nothing is being showed on ImageViewAndroid,毕加索,Firebase 存储 - 检索图像,ImageView 上没有显示任何内容
【发布时间】:2018-12-29 17:58:17
【问题描述】:

我已经尝试过使用 Glide.with(opDetails.this).using(new FirebaseImageLoader()).load(uri).into(imgPhoto1);但是 .using() 有一些问题。 我现在正在尝试使用毕加索。虽然编译器没有显示错误,但 ImageView 没有显示图像,我不明白为什么。

    storage = FirebaseStorage.getInstance();
    storageRef = storage.getReference();

    storageRef.child("images/4736af35-608d-4b97-95ba-029ef471c5eb.png").getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
        @Override
        public void onSuccess(Uri uri) {
            Picasso.with(opDetails.this).load(uri).into(imgPhoto1);

        }
    }).addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception exception) {

        }
    });
}

更新:

Firebase Storage Image

Storage Rules

提前致谢。

【问题讨论】:

  • 您应该使用错误侦听器并查看显示的错误 - Picasso.with(opDetails.this).load(uri).into(imgPhoto1, new Callback() { @Override public void onSuccess() { } 公共无效 onError() { } });还要在 addOnFailureListener 中添加一个日志,以查看是否从数据库中正确获取了 uri。
  • 它说 com.google.storage.StorageException: Object does not exist at location
  • 这意味着存储图像可能存在问题。发送存储文件夹及其结构@NunoLeal
  • 问题已更新@Raj

标签: android image firebase storage picasso


【解决方案1】:

试试这个:-

storageRef.child("images/4736af35-608d-4b97-95ba-029ef471c5eb").getDownloadUrl().addOnSuccessListener....

【讨论】:

  • 删除 .png 后,您在 addOnFailureListener() @NunoLeal 中遇到什么异常?
  • 无它突然移动到上一个活动而不显示原因@Raj
  • 已经尝试使用: storageRef = storage.getReferenceFromUrl("gs://... .appspot.com/");但仍然是相同的@Raj
猜你喜欢
  • 2021-08-09
  • 2017-02-15
  • 2020-05-02
  • 1970-01-01
  • 2021-06-02
  • 1970-01-01
  • 2021-06-09
  • 1970-01-01
相关资源
最近更新 更多