Navigation Component in RecyclerView Adapter
I think its better to add this to the accepted answer:
holder.itemView.setOnClickListener(
Navigation
.createNavigateOnClickListener(R.id.action_searchFragment_to_artistFragment).onClick(holder.itemView)
)
You are using lambda which is itself a click listener. Check this Navigation Docs which has proper implementation of click listener using navigation id and createNavigationListener.
Use below code for your case.
holder.itemView.setOnClickListener(
Navigation.createNavigateOnClickListener(R.id.action_searchFragment_to_artistFragment)
)
OR, try this way
holder.itemView.setOnClickListener{ view ->
view.findNavController().navigate(R.id.action_searchFragment_to_artistFragment)
}