首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >KOTLIN:滑动图像没有从Firebase-Storage加载到碎片中

KOTLIN:滑动图像没有从Firebase-Storage加载到碎片中
EN

Stack Overflow用户
提问于 2020-08-27 09:19:37
回答 1查看 158关注 0票数 0

Glide似乎不会从Firebase-storage中的指定路径加载图像。由于我的代码中没有错误,图像上传也没有错误,所以在加载时我仍然得不到更新的片段页面。

要声明的代码:

代码语言:javascript
复制
 override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        if (requestCode == RC_SELECT_IMAGE && resultCode == Activity.RESULT_OK &&
            data != null && data.data != null
        ) {

            val selectedImagePath = data.data
            val selectedImageBmp = MediaStore.Images.Media
                .getBitmap(activity?.contentResolver, selectedImagePath)

            val outputStream = ByteArrayOutputStream()
            selectedImageBmp.compress(Bitmap.CompressFormat.JPEG, 90, outputStream)
            selectedImageBytes = outputStream.toByteArray()

            Glide.with(this)
                .load(selectedImageBytes)
                .into(imageView_profile_picture)

            pictureJustChanged = true
        }

    }



        override fun onStart() {
            super.onStart()
            FirestoreUtil.getCurrentUser { user ->
                if (this@HomeFragment.isVisible) {
                    edittextPersonname.setText(user.name)
                    editTextBio.setText(user.bio)
                    editTextTextEmailAddress.setText(user.email)
                    edittextage.setText(user.age)
                    if (!pictureJustChanged && user.profilePicturePath != null)

                        
                        Glide.with(this)
                            .load(StorageUtil.pathToReference(user.profilePicturePath))
                            .apply(RequestOptions()
                                .placeholder(R.drawable.ic_circle))
                            .into(imageView_profile_picture)

                }
            }
        }

下面是我来自Gradle的库包:

//glide

代码语言:javascript
复制
 implementation 'com.github.bumptech.glide:glide:4.11.0'

    kapt 'com.github.bumptech.glide:compiler:4.11.0'

apply plugin: 'kotlin-kapt'
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-08-27 09:19:37

出于某些原因,Android Kotlin Glide v4要求您在gradle项目中声明两次“应用插件”库(即

第一个实例:

第二个实例:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63607810

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档