ZariApps
08/30/2020, 6:56 PMIan Lake
08/30/2020, 8:13 PMview.findNavController().navigate(R.id.your_id)
- you never reference fragments by class nameZariApps
08/31/2020, 5:37 PMoverride fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
val view: View = inflater.inflate(R.layout.fragment_title, container, false)
view.Btn.setOnClickListener { view: View ->
view.findNavController().navigate(R.id.action_titleFragment_to_secondFragment)
}
return view
}
Ian Lake
08/31/2020, 5:47 PMZariApps
08/31/2020, 5:47 PMZariApps
08/31/2020, 5:47 PMZariApps
08/31/2020, 5:47 PMZariApps
08/31/2020, 5:48 PMoverride fun onBindViewHolder(holder: ViewHolder, position: Int) {
val currentItem = homeFeed.data[position]
holder.itemView.setOnClickListener(
Navigation.createNavigateOnClickListener(R.id.action_secondFragment_to_ListFragment)
)
ZariApps
08/31/2020, 5:48 PMIan Lake
08/31/2020, 5:51 PMcurrentItem
might have fields you want to pass as arguments to your call or would be where you'd store the R.id
for the destination that row is associated with