Android. Access to NavigationDrawer from fragment
-
Used by NavigationDraver, there is a problem when you start a piece of his menu, the relevant menu is distinguished, but sometimes it is necessary to go to the section not through the menu but by the event, and then when the menu is opened, the previous paragraph will be added. Since it's written in Activity, I can't directly influence his development. Please indicate how to get access from a fragment to the NavigationDrawer. You can make it static, but it's a pepper colt.
-
We can differently:
- The fragment has a method.
getActivity()
the result of which you can cast into your activate class and call her method. - Libraries can be used to correct/take user events. In the activate, sign for their receipt, and in the recipient's method, do something with the diver. Send it out of the fragment. Library https://github.com/greenrobot/EventBus and http://square.github.io/otto/
- The fragment has a method.