Search code examples
androidnavigation-drawermulti-module

Android NavigationDrawer in multi module project


I have multiple modules in my project for example:

  • app // this is the main app module

  • settings

  • login

  • places

etc.

How to use a navigation drawer in my project? I don't want to write the navigation drawer code in every module.

I tried that in my app module I start an another module with startActivityForResult() method, but if the user would like to go from this module to another I finish the current method and start the second module from the app module. But this is not so good because the user see the app module view for a while...


Solution

  • From architecture approach, the drawer should be in presentation layer (app module) however you could separate it somewhere else and use callbacks to tell the presentation layer what it should do when an item is clicked.

    however, I would have keep it in the app module because that module could depend on all the other modules but not the other way around.