I have a question that is bugging me for a long time,
In navigation component, when using .navigate(int resId) what makes a difference in passing an action id vs fragment id?
example:
<fragment android:id="@+id/loginFragment"
android:name="com.example.myapp.ui.main.LoginFragment"
android:label="@string/login"
tools:layout="@layout/fragment_login" >
<action
android:id="@+id/action_login_to_emailLoginFragment"
app:destination="@id/emailLoginFragment"
app:popEnterAnim="@anim/slide_in_right"
app:popExitAnim="@anim/slide_out_right"
app:popUpTo="@+id/emailLoginFragment"
app:popUpToInclusive="true"/>
</fragment>
<fragment android:id="@+id/emailLoginFragment"
android:name="com.example.myapp.ui.main.EmailLoginFragment"
android:label="EmailLoginFragment"
tools:layout="@layout/fragment_login_email" />
In the above scenario, what will be the difference if
1) use .navigate(R.id.action_login_to_emailLoginFragment);
2) use .navigate(R.id.emailLoginFragment);
And i have one more query, I know that .navigate(int resId) will replace the fragment, in that case how to retain state of views in previous fragment?