This is my data class :-
data class User(val imagepic: Int)
Passing value to recycler view :-
users.add(User(R.drawable.splash_bc))
users.add(User(R.drawable.image))
users.add(User(R.drawable.splash_bc))
users.add(User(R.drawable.share))
users.add(User(R.drawable.splash_bc))
users.add(User(R.drawable.image))
this is my share function :- Here I am passing user as Input
fun shareString(user: User) {
var image_path: String
val file : File = File(user)
val uri = Uri.fromFile(file)
val intent = Intent(Intent.ACTION_SEND)
intent.type = "image/*"
intent.putExtra(Intent.EXTRA_STREAM, uri)
startActivity(itemView.context, Intent.createChooser(intent,"Share to :"),null)
}
I am not able to share image. getting casting error everytime. Please help on this