Android navigation component and BottomNavigationView in a multi module application
Asked Answered
A

1

7

I've been trying to create a multi module application where every feature is a standalone library (module). Single activity pattern is applied throughout the project.

The structure consists of an 'app' module which contains the MainActivity.

A core module which is inherited by the other modules.

And three modules for the three different features of the application. These three modules along with the 'app' modules implement the 'core'

In the 'MainActivity' there is a BottomNavigationView which is used to navigate the user between different screens (fragment). It has three tabs for three different features.

I've created different navGraphs for different modules and included them in app's navGraph, but I can't make it work.

Question: How I'm supposed to use navigation component with the BottomNavigationView to navigate between different screens?

link to git repo. This is how far I've gotten so far.

Adulthood answered 10/2, 2019 at 13:44 Comment(1)
were you able to resolve?Selway
C
0

í ám little bit late, ya but am also working on a similar kind of application, in order to navigate to the different module on tap of bottom navigation I had simply include all the navigation graph in-app module navigation graph, like -

<include app:graph="@navigation/login_nav" />
<include app:graph="@navigation/nav_home" />
<include app:graph="@navigation/nav_profile" />

then add this id' in the menu file of bottom navigation.

Another way, you can go through the deep link and creating the deep link and then can navigate like- findNavigation().navigate(URI)

Although I am also facing issue while using the deep link in the module- module communication.

Courage answered 19/9, 2020 at 17:45 Comment(1)
how did you resolve?Selway

© 2022 - 2024 — McMap. All rights reserved.