我正在使用Firebase身份验证中的Userprofileupdaterequest成功设置个人资料图片Uri并使用Firebase当前用户函数在另一个活动中获取,如下所示,但无法将其加载到圆形ImageView ....
mAuth = FirebaseAuth.getInstance();
FirebaseUser user = mAuth.getCurrentUser();
if (user == null) {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
} else {
String name = user.getDisplayName();
String email = user.getEmail();
Uri photoUrl = user.getPhotoUrl();
tv_username.setText(name);
Picasso.with(Display.this)
.load(photoUrl)
.into(iv_profile);
// Check if user's email is verified
boolean emailVerified = user.isEmailVerified();
String verified;
if (emailVerified) {
verified = "success";
} else {
verified = "not verified";
}
// The user's ID, unique to the Firebase project. Do NOT use this value to
// authenticate with your backend server, if you have one. Use
// FirebaseUser.getToken() instead.
String uid = user.getUid();
tv_display.setText(email);
tv_email_verification.setText(verified);
调试器报告,实际的uri是在uriString键,这是我应该获取的uri我该怎么做..
答案 0 :(得分:0)
对我而言,它与毕加索合作,但有时候用户形象不存在。对于这些情况,我使用默认图像作为占位符和错误图像:
Picasso.with(this)
.load(photoUri)
.placeholder(R.mipmap.ic_unknown_user)
.error(R.mipmap.ic_unknown_user)
.into(imgProfileImage);
在我的XML文件中:
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/imgProfileImage"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@mipmap/ic_usuario"
app:border_color="#ffffff"
app:border_width="2dp"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_marginTop="28dp"
/>