I need to send a specific image from my recyclerview that has been clicked to the new activity that will display the image. The question is how do I convert my image to bitmap or something like that so I can send them using intent? Here's my code:
RecyclerViewAdapter.kt
class ViewHolder(view: View) : RecyclerView.ViewHolder(view){
fun bindItem(items: Item) {
itemView.name.text = items.name
itemView.desc.text = items.desc
Glide.with(itemView.context).load(items.image).into(itemView.image)
itemView.setOnClickListener {
itemView.context.startActivity(itemView.context.intentFor<DetailsActivity>("image" to bitmap, "name" to items.name, "desc" to items.desc))
}
}
}
SecondActivity
val intent = intent
name = intent.getStringExtra("name")
image = intent.getStringExtra("image")
desc = intent.getStringExtra("desc")
nameTextView.text = name
descTextView.text = desc
Glide.with(this)
.load(image)
.into(imgPhotos)
I have already tried all the code that are provided on this site, but they all didn't work. Thanks!