Search code examples
androidnavigationandroid-jetpack-navigation

Navigation graphs and multiple host activities


I have a feature module, splash, which has a nav_splash graph and a SplashActivity.

When I navigate to a second feature module, main, which has a nav_main graph and a MainActivity, instead of using MainActivity as host (even in the navigation editor it is appearing as host), it keeps using SplashActivity as host.

So instead of navigating to nav_main graph, now I have to navigate to an activity (MainActivity) to force the use of this activity as host.

Is this intentionally? Or is it a bug?

The first reason to use multiple activities is that they have different themes in the manifest file.


Solution

  • Unless you're specifically navigating to an <activity> destination, you'll stay in the same activity, that is working as intended.