I have no idea how to, using the new navigation architecture component, navigate from my main screen (with a FloatingActionButton
attatched to a BottomApp
Put it in MainActivity and setOnClickListener in onStart()
of the activity and it will work fine.
override fun onStart() {
super.onStart()
floatingActionButton.setOnClickListener {
it.findNavController().navigate(R.id.yourFragment)
}
}
Note:This solution is like and hack and better is to follow Activity LifeCycle and setUp OnClickListener when the activity is ready to interact.
Similar question [SOLVED]