即使检索用户链接图片也无法加载该链接(firebase身份验证中的firebase photourl)

问题描述 投票:0回答:1

用户在创建帐户时可以成功更新其个人资料图片。但是当他们进入个人资料信息菜单时,他们的个人资料照片不会加载。

我能够使用“ currentuser.getPhotoUrl”检索图片的文件路径但我无法将其加载到CircleImageView。

我从getPhotoUrl检索的文件路径或链接是“ // media / external / images / media / 80495”]

这是代码

public class ProfileFramgent extends Fragment {


    private CircleImageView profiledp;


    private FirebaseAuth mAuth;

    private FirebaseUser currentUser;
    private static final String TAG = "ProfileFramgent";

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View v =  inflater.inflate(R.layout.fragment_profile,container,false );


        profiledp = v.findViewById(R.id.profiledp);

        thiscontext = container.getContext();

        mAuth = FirebaseAuth.getInstance();
        FirebaseUser currentUser = mAuth.getCurrentUser();



        Uri photoUrl = currentUser.getPhotoUrl();
        Glide.with(getActivity())
                .load(photoUrl)
                .listener(new RequestListener<Drawable>() {
                    @Override
                    public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
                        Log.d(TAG, "onLoadFailed: error glide"+e.getMessage());
                        return false;
                    }

                    @Override
                    public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
                        return false;
                    }
                })
                .into(profiledp);





        return v;
    }
}

这是我不断收到的错误

error glide无法加载资源有3个原因:java.io.FileNotFoundException(对于content:// media / external / images / media / 80495,没有条目)java.io.FileNotFoundException(对于content:// media / external / images / media / 80495,没有条目)java.io.FileNotFoundException(对于content:// media / external / images / media / 80495,没有条目)致电GlideException#logRootCauses(String)了解更多详细信息

我该如何解决

android firefox google-cloud-firestore firebase-authentication firebase-storage
1个回答
0
投票

尝试一下

Uri photoUrl = FirebaseAuth.getInstance().getCurrentUser().getPhotoUrl();
© www.soinside.com 2019 - 2024. All rights reserved.