【发布时间】:2021-08-23 19:20:35
【问题描述】:
我有一个错误。当用户上传他的图片时。其他数据都消失了,只有配置文件 URI 可见。
目前,我有 5 个字符串
- 姓名
- 电子邮件
- 密码
- 个人资料(图片 URI)
- 参考编号
- 硬币
但是,当用户上传他们的个人资料照片时,所有数据都会被删除。
仅显示个人资料图片 URI
我已在此处附上代码
private void updateUserProfile() {
Map<String,String > profile = new HashMap<>();
profile.put("profile",imageUri.toString());
database
.collection("Users") // the path of users.
.document(FirebaseAuth.getInstance().getUid()) // to update in the current users.
// .update(user)
.set(profile)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void unused) {
Toast.makeText(getContext(), "Photo Updated!", Toast.LENGTH_SHORT).show();
}
});
}
【问题讨论】:
标签: java android firebase google-cloud-firestore