scenario :
MainActivity.kt
: activity_main.xml
contains my_nav_host_fragment
in mobile_navigation.xml
first_frag_dest is the startDestination and there is second_frag_dest also, with respective classes FirstFragment.kt
and SecondFragment.kt
.
I have setup bottom navigation for switch between two fragments using the Android Jetpack Navigation components.
When the Second Fragment is opened for the first time if FirbaseUser is null, A Welcome Activity is launched which is configured for GoogleSignInusing Firebase.
In WelcomeActivity.java
I have a function updateUI(user: FirebaseUser)
to update the UI.
Now, what code should I write in updateUI function such that I am redirected back to the Second Fragment.
Please tell how to do it using JetPack Navigation components.
Note: Principles of navigation say that only one activity must exist but here I am compelled to use an Activity for GoogleSignIn due to Firebase restrictions.