【问题标题】:Android - Firebase Storage Url as StringAndroid - Firebase 存储 URL 作为字符串
【发布时间】:2018-05-10 10:52:07
【问题描述】:

如何获取我以字符串形式存储在 Firebase 存储中的图像的下载 URL?

我曾尝试使用 Firebase 文档中的代码,但我不知道如何将其作为字符串获取。谢谢。

storageRef.child("users/me/profile.png").getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
    // Got the download URL for 'users/me/profile.png'
}}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
    // Handle any errors
}});

【问题讨论】:

    标签: java android firebase firebase-storage


    【解决方案1】:

    要将uri 对象转换为字符串,请使用以下代码行:

    String stringUri = uri.toString();
    

    【讨论】:

      猜你喜欢
      • 2020-12-11
      • 2019-10-26
      • 1970-01-01
      • 2020-12-14
      • 1970-01-01
      • 2014-08-25
      • 2021-03-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多