I have a feed fragment that its main element is a RecyclerView of posts.
I am managing the recycler with Lisa Wray's Groupie library https://github.com/lisawray/groupie
Now in my navigation graph I have an action connecting the feed fragment to the another fragment, and I try to call this action with an on click listener I create in the bind function of the adapter.
val action=FeedFragmentDirections.actionDestinationFeedToDestinationAddToBucket(image.id)
findNavController().navigate(action)
I keep getting an error saying navigation destination XXXXX is unknown to this NavController
I've tried adding a few things before the findNavController()
, like viewHolder.itemView
or viewHolder.root
but nothing works.
When I use viewHolder.itemView.rootView
I get this error instead View DecorView@a190adf[MainActivity] does not have a NavController set
I don't know what DecorView is.
Any ideas how I can implement my oncick listeners properly?