0

I have setup drawer using NavigationUI

 NavigationUI.setupActionBarWithNavController(this, navController, drawerLayout)
 NavigationUI.setupWithNavController(navView, navController)

How can i remove/un-link the drawerLayout and toolbar from navController?

Harsh Jatinder
  • 833
  • 9
  • 15
  • What are you doing that you feel that you need to unlink the drawerlayout and toolbar? – ianhanniballake Sep 28 '19 at 23:46
  • Nothing productive or work related, just playing with Navigation Components, Exploring the possible use cases etc. Like what if later on I want to change the UI from DrawerLayout to BottomNav view etc – Harsh Jatinder Sep 29 '19 at 06:11

1 Answers1

0

NavigationUI keeps a WeakReference to the Toolbar and DrawerLayout you pass into it, automatically cleaning up the listeners when any of the underlying views are garbage collected (say, if your Toolbar is part of a Fragment's layout). There should be no need to manually unregister a listener set with NavigationUI and there's no API to do it if you did want to do it.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443