Android Jetpack navigation, host fragment inside another host fragment : <p>I'm trying to achieve a simple design. One activity with a host fragment.</p>

<p>The thing is, one of the destinations has a bottom navigation bar.</p>

<p>Here's a paint sketch 
<a href="https://i.stack.imgur.com/VyZSl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VyZSl.png" alt="enter image description here"></a></p>

<p>After a little bit of research, I discovered that the best practice is to have a single Activity with a host fragment. </p>

<p>In my particular case, the bottom navigation bar should not be visible in the login and register fragments and just hiding it doesn't seem right to me.</p>

<p>I managed to create an activity with a bottom navigation bar connecting <strong>main fragment</strong> to <strong>frag 1</strong>, <strong>frag 2</strong> or <strong>frag 3</strong>, but now I need to add the <strong>login fragment</strong> and <strong>register fragment</strong> and I'm not sure how to handle the navigation.</p>

<p>Here's the code for the app without the authentication fragments.</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout
    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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".Presentation.MainActivity"&gt;

    &lt;androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        app:title="Glucose Entries"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?colorPrimary"
        android:theme="@style/ToolbarTheme"/&gt;

    &lt;com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_nav"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:menu="@menu/bottom_navigation_bar"/&gt;

    &lt;fragment
        android:id="@+id/nav_host_fragment"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:name="androidx.navigation.fragment.NavHostFragment"
        app:navGraph="@navigation/mobile_navigation"
        app:defaultNavHost="true" /&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>Also:</p>

<pre><code>class MainActivity : AppCompatActivity() {

    private lateinit var navController: NavController

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        setSupportActionBar(toolbar)

        navController = Navigation.findNavController(this, R.id.nav_host_fragment)
        bottom_nav.setupWithNavController(navController)
        NavigationUI.setupActionBarWithNavController(this, navController)
    }

    // stuff
}
</code></pre>

<p>And the navigation file:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;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/mainListFragment"&gt;

    &lt;!--frag 1 --&gt;
    &lt;fragment
        android:id="@+id/mainListFragment"
        android:name="com.gluco.Presentation.MainList.MainListFragment"
        android:label="Glucose Entries"
        tools:layout="@layout/main_list_fragment"&gt;
    &lt;/fragment&gt;

    &lt;!--frag 2 --&gt;
    &lt;fragment
        android:id="@+id/statisticsFragment"
        android:name="com.gluco.Presentation.Statistics.StatisticsFragment"
        android:label="statistics_fragment"
        tools:layout="@layout/statistics_fragment" /&gt;

    &lt;!--frag 3 --&gt;
    &lt;fragment
        android:id="@+id/settingsFragment"
        android:name="com.gluco.Presentation.Settings.SettingsFragment"
        android:label="SettingsFragment" /&gt;

&lt;/navigation&gt;
</code></pre>

<p>Should I just hide the navigation bar on fragments where is not supposed to be?</p>

<p>Also, I'm thinking another solution could be to not use the automatic navigation provided from the bottom navigation bar and create my own actions to navigate from <strong>main fragment</strong> to <strong>frag 1</strong>, <strong>frag 2</strong> or <strong>frag 3</strong></p>
