I created a NavigationDrawerFragment, which is actually just a slightly modified version of the code Android Studio generates.
I have a Dashboard activity that contains NavigationDrawerFragment and that can launch several other activities, each of which also contain the NavigationDrawerFragment. Let's call one of these activities Foo.
If I enter Foo from the Dashboard using the Dashboard's nav drawer, then open Foo's nav drawer, the back button will correctly close the nav drawer. HOWEVER, if I entered Foo using a UI element (that was in place before I implemented a nav drawer), then open Foo's nav drawer, the back button returns to the Dashboard activity rather than closing the nav drawer.
I can't figure out why this is occuring. For the NavigationDrawerFragment I have an ItemClickListener and for the UI element I have a ClickListener, but in both situations I am launching a new Foo activity using an intent.
I am wondering if there is something being set that I just don't realize, and if I have control over that something.
I know that I could override onBackPressed to check for the drawer being open (as shown here), but that feels hacky as there is obviously some behavior happening here that I am not aware of.
Edit: This has something to do with ActionBar-PullToRefresh. I removed it from Foo and the nav drawer works correctly.
Edit 2: I was wrong about pull-to-refresh, as @adneal pointed out. There must have been a coincidence that made me think that. I ended up overriding onBackPressed and conditionally checking if the drawer is open or not. Also as @adneal pointed out, the problem has to do with focus. I am still so very curious as to how the focus could be different when launching the activities the same way, but from different places.