Multiple-Backstack-Navigation icon indicating copy to clipboard operation
Multiple-Backstack-Navigation copied to clipboard

How to add new fragment in the root of mobile_navigation

Open sinhpn92 opened this issue 5 years ago • 0 comments

Hi, Your repo so greate. But, I'm looking for the solution to add a fragment which have same level with form, home, list. That's mean the application have the main screen is the same with the current repo. I need more fragment like that:

<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/app_navigation"
    app:startDestination="@id/home">

    <include app:graph="@navigation/home" />

    <include app:graph="@navigation/list" />

    <include app:graph="@navigation/form" />

    <action android:id="@+id/action_open_detail"
        app:destination="@id/nav_detail"/>

    <fragment android:id="@+id/nav_detail"
        android:name="com.example.android.navigationadvancedsample.detail.Detail"
        android:label="Detail"
        tools:layout="@layout/fragment_detail"/>

</navigation>

I want to open the detail screen in the tab screen and I will be hide the bottomnav when open the detail screen from any tab by handle destination changed. Howerver, I navigation by findNavController().navigate(R.id.action_open_detail). But I have got error: navigation destination com.example.android.navigationadvancedsample:id/action_open_detail is unknown to this NavController

Have any suggest to open detail nav?

Thanks for your time.

sinhpn92 avatar Aug 29 '20 09:08 sinhpn92