I have an application using navigation drawer that provides list of locations. In the drawer, there are several options (like choosing country, city, etc) that user can setup before showing the corresponding list in the main activity.
Is there any possibility to refresh the list when user close the drawer, or maybe there is another way to solve this? I've tried to search for tutorials but found nothing about this drawer closed listener. Any suggestions would be helpful, thanks!
reVerse answer is right in case you are using ActionBar as well. in case you just use the DrawerLayout directly, you can add a DrawerListener to it:
As per kit's comment,
addDrawerListener()
should be used now thatsetDrawerListener()
has been deprecated.When you setup the
ActionBarDrawerToggle
you can "implement" theonDrawerClosed
andonDrawerOpened
callbacks. See the following example from the Docs:Edit: Now the setDrawerListener is deprecated, use addDrawerListener instead.