问题描述
Glide似乎没有从Firebase-storage中的指定路径加载图像。 Desite是我的代码中没有错误,并且图像上传没有错误,在加载时我仍然没有获得更新的Fragment页面。
要声明的代码:
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 ([email protected]) {
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
implementation 'com.github.bumptech.glide:glide:4.11.0'
kapt 'com.github.bumptech.glide:compiler:4.11.0'
apply plugin: 'kotlin-kapt'