How to add element from one TabLayout(All) to another TabLayout(Favorites) by pressing "favourites" btn
I have two Tab Layouts: All, Favorites. All tab layout has RecyclerView. Every element in RecyclerView has title,description,date and favourite button. I need to realize the next logic: when i press the favourite btn, need to add this selected element of RecyclerView to Favourites tab layout. Please, I need your help with this task! I try to add the example of code this: AllFragment.kt class AllFragment : Fragment() { private var layoutManager: RecyclerView.LayoutManager? = null private var adapter: RecyclerView.Adapter<RecyclerAdapter.ViewHolder>? = null override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val recyclerView = view.findViewById<RecyclerView>(R.id.recyclerView) layoutManager = LinearLayoutManager(requireActivity()) recyclerView?.layoutManager = layoutManager adapter = RecyclerAdapter() recyclerView?.adapter = adapter } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_all, container, false) } } FavouritesFragment.kt class FavouritesFragment : Fragment() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) } override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_favourites, container, false) } }