Skip to content

Instantly share code, notes, and snippets.

@SanjayDevTech
Created June 23, 2021 05:03
Show Gist options
  • Save SanjayDevTech/81a144b3d1ec83d677e6fa874ed7fe2e to your computer and use it in GitHub Desktop.
Save SanjayDevTech/81a144b3d1ec83d677e6fa874ed7fe2e to your computer and use it in GitHub Desktop.
Navigation First Fragment click listener calling action
class NavFirstFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
return inflater.inflate(R.layout.fragment_nav_first, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// Logic starts here
view.findViewById<Button>(R.id.navigateBtn).setOnClickListener {
findNavController().navigate(R.id.action_navFirstFragment_to_navSecondFragment)
}
// Logic ends here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment