Search code examples
androidslidingmenucode-duplication

feinstein's SlidingMenu library, Define BehindContentView in every activity?


I am using feinstein's SlidingMenu library, I want to use the SlidingMenu in every activity i have. Should I have to write the SlidingMenu code in every activty?!, or can I write the slidingMenu in a class and start calling the class in every activity or is there any other way? Thanks in advance.


Solution

  • Best way would be to work with fragments. Add the drawer to your MainActivity extends FragmentActivity. Then add and remove fragments instead of switching activities.

    Also, there's no need to use SlidingMenu anymore, Google added their own implementation, called NavigationDrawer to the Support Library. See http://developer.android.com/training/implementing-navigation/nav-drawer.html