Reputation: 285
I am loading image stored in firebase firestore using Glide. Initially I was loading the image in the same activity where the url link is being fetched from Firebase. Things were running smooth till this point. Now I am trying to load this image in a popUp Activity (basically a different activity). The url is being fetched in the original activity and then being passed on to the popUp Activity.
I have checked that the URL passed to the new activity is correct, however, the same is not loading. Can some one help. The code in the new activity is as follows:
val catch = intent.getStringExtra("imgSrc")
popUpText.visibility = View.GONE
if(catch!=null){
val presImage = PhotoView(this@PopUp)
val param2: LinearLayout.LayoutParams = LinearLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.WRAP_CONTENT, 1.0F)
param2.setMargins(0,64,0,0)
presImage.layoutParams = param2
presImage.scaleType = ImageView.ScaleType.FIT_CENTER
val popProgress = ProgressBar(this@PopUp)
popProgress.layoutParams = param2
popProgress.setBackgroundColor(Color.parseColor("#beb2bb"))
popLayout.addView(popProgress)
Glide.with(this@PopUp)
.load(Uri.parse(catch))
.listener(object: RequestListener<Drawable>{
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: com.bumptech.glide.request.target.Target<Drawable>?,
isFirstResource: Boolean
): Boolean {
return false
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
target: com.bumptech.glide.request.target.Target<Drawable>?,
dataSource: DataSource?,
isFirstResource: Boolean
): Boolean {
popProgress.visibility=View.GONE
return false
}
})
.into(presImage)
}
The value of catch is correct. I have checked that by logging the same. I understand that the error I may be making is likely very trivial, but have spent a lot of time unable to decipher.
Upvotes: 0
Views: 126
Reputation: 284
Pls add your child view into parent view to show up on screen.
in that part of code above. you just loaded image into imageView but forgot add imageView into parent View.
Hope this help.
Upvotes: 1