I have a Ordering Fragment where use click apply order button, and then if user is not logged-in we navigate to login_nav_graph. After success login I open main_nav_graph but it opens it with HomeFragment because it is root. So, how can I open after succesfull login open OrderingFragment which is in main_nav_graph ?
Asked
Active
Viewed 134 times
1
-
check this answer :https://stackoverflow.com/questions/59985632/navigate-to-a-fragment-from-another-graph-without-it-being-the-start-destination – Muhammad Asad Dec 29 '21 at 12:10
1 Answers
0
Suppose below is your navigation.xml
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mobile_navigation"
app:startDestination="@+id/navigation_main_nav">
<fragment
android:id="@+id/navigation_home"
android:name="com.HomeFragment"
android:label="@string/title_home"
tools:layout="@layout/fragment_home" />
<fragment
android:id="@+id/navigation_main_nav"
android:name="com.MainNavFragment"
android:label="@string/title_main_nav"
tools:layout="@layout/fragment_main_nav" />
so in app:startDestination= remove "@+id/navigation_home" and add "@+id/navigation_main_nav" so after success login it's open main_nav_graph

Yash Shah
- 52
- 4