Skip to content Skip to sidebar Skip to footer

Iimpalement Share Intent, Using Firebase Recycler Adapter

I am using FirebaseRecylcerAdapter, trying to share the image or data of my RecylcerView to other apps using share intent below is my adapter where I am trying to get the button on

Solution 1:

The model object that you get as an argument in the onBindViewHolder() method cannot be used in onCreateViewHolder() method because is out of scope. If you need to set on click listener on the sh button, set it in the ViewHolder class rather than in onCreateViewHolder method. In this way, you can access the model object because is already send into that class earlier, when you have used:

viewHolder.setDetails(applicationContext, model.image, model.title)

In that way, you can attach the listener and send the clicked object to the next activity. However, a more appropriate way of solving this would be to use a callback, as explained in this repo.

Post a Comment for "Iimpalement Share Intent, Using Firebase Recycler Adapter"