简体   繁体   English

无法在circleimageview中设置从Firebase当前用户拍摄的照片Uri?

[英]can't set photo Uri which is taken from firebase current user in circleimageview.?

I'm setting up profile pic Uri using Userprofileupdaterequest in Firebase auth successfully set and fetched in another activity using Firebase currentuser function as below but couldn't load it in circle ImageView.... 我正在使用Firebase身份验证中的Userprofileupdaterequest设置配置文件pic Uri,成功设置并使用Firebase currentuser函数在另一个活动中进行了获取,如下所示,但无法将其加载到圆圈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);

debugger report,actual uri is in uriString key thats the uri i should fetch how can i do that.. 调试器报告,实际uri在uriString键中,这是我应该获取的uri。

在此图像中,你们可以看到实际数据在uriString键中,想要获取我如何

For me it's working with Picasso, but there are times when user image does not exist. 对我来说,它可以与毕加索一起使用,但是有时候用户图像不存在。 For these cases, I used a default image as placeholder and error images: 对于这些情况,我使用默认图像作为占位符和错误图像:

Picasso.with(this)
        .load(photoUri)
        .placeholder(R.mipmap.ic_unknown_user) 
        .error(R.mipmap.ic_unknown_user)        
        .into(imgProfileImage);

And in my XML file: 在我的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"
     />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM