java - Android Firebase -- 存储 Google 个人资料图片

标签 java android firebase firebase-authentication

我正在为我的应用程序创建一个帐户设置页面。所以我给出了一个 ImageView 来设置个人资料图片。

我通过以下方式加载图像:

Glide.with(AccountSetupActivity.this)
                        .load(mAuth.getCurrentUser().getPhotoUrl())
                        .into(mCircularProfile); //mCircularProfile is ImageView

它工作完美。问题是当我尝试存储此文件时。

mImageUri = mAuth.getCurrentUser().getPhotoUrl();

StorageReference filePath
                    = mStorageProfilePicturesRef.child("just a random name for testing");
            //Putting The Image At The Specific File Path
            filePath.putFile(mImageUri)

非常感谢任何帮助!

最佳答案

URL 和 Uri 之间是有区别的。该错误是因为您试图将字符串 URL 存储到 uri 中。将 Url 转换为 Uri。

mImageUri =  Uri.parse(mAuth.getCurrentUser().getPhotoUrl());

关于java - Android Firebase -- 存储 Google 个人资料图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41781592/

相关文章:

java - Log4J 的默认 MessageFactory 是什么

java - 如何调试在 Debug模式下而不是在生产模式下工作的 Play 框架程序?

java - 检测 JTextField 中的 Enter 键并在 actionperformed 中执行某些操作

java - 类型不匹配 : cannot convert from Class<capture#1-of ? > 到 Class<?>[]

android - 错误 "package android.support.v7.app does not exist"

javascript - 在Firefox中关闭/隐藏Android软键盘

swift - 使用 HealthKit 后台交付检索步骤后,在后台将数据写入 Firebase

c# - 无法从 Nuget 安装包 System.Net.Http

android - 使用 firebase 添加额外的用户信息

android - 如何在 View Holder 上的 OnClick Adapter 中不获取 null 的情况下获取 AdapterPositions?