I am using a Fragement for navigation drawer and hence can\'t use onPostCreated
to call syncState
public class NavigationDrawerFragment extends Frag
I had this problem as well. For me, importing android.support.v7.app.ActionBarDrawerToggle
instead of android.support.v4.app.ActionBarDrawerToggle
fixed it. You also have to remove the R.drawable.ic_drawer
argument when you define mDrawerToggle:
mDrawerToggle = new ActionBarDrawerToggle(
getActivity(),
mDrawerLayout,
R.string.navigation_drawer_open,
R.string.navigation_drawer_close
)
If that doesn't work, try some of the answers to this question.
The accepted answer was not solving it for me, I found out I had the wrong override for onPostCreate
@Override
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onPostCreate(savedInstanceState, persistentState);
mDrawerToggle.syncState();
}
It must be
@Override
public void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mDrawerToggle.syncState();
}