How to Communicate Between Fragments and Activity When Using Navigation Component

The android team introduced Navigation Component 2 years ago to encourage developers to use the single activity UI pattern. With the introduction of the navigation graph view in android studio, it provided a visually represented graph to work with fragments. Although it introduces a standard way to follow the single activity UI design pattern sometimes it can introduce new challenges to overcome. one of which is the way of communicating between navigation host activity and its fragments. The full project is added to Github.

Continue reading