0

I want to use same navigation drawer in multiple activities so I have implemented navigation drawer in MainActivity and extended this MainActivity in other Activities in which I want to use the same navigation drawer. When i Touch the Drawer Icon, it is highlighting but the drawer is not opening.

I have followed the code explained in this link: Same Navigation Drawer on different Activities

Community
  • 1
  • 1
Chaman Saini
  • 213
  • 1
  • 6

1 Answers1

0

Make sure you create your ActionBarDrawerToggle.

I personally do it in Activity.OnCreate() like this:

if (mDrawerLayout != null) {//for large screens it is null
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, 0, 0);
    mDrawerLayout.setDrawerListener(this);
}

So in my case I should call super.onCreate() in the descendant class.

Edit

You may also look if all the methods of DrawerListener are overridden correctly.

Still it's not a standard way to use Navigation Drawer. Make sure if your design is what you really need - fragments are more flexible and easy to use. Here is another related post.

Community
  • 1
  • 1
sberezin
  • 3,266
  • 23
  • 28