Skip to content Skip to sidebar Skip to footer

Cannot Listen Clicks On Up Caret

I've a single activity(MainActivity) which extends actionbaractivity and implements NavigationDrawer. I've setup the drawertoggle in the activity itself. I'm creating new fragments

Solution 1:

SOLVED FINALLY

I figured out the problem, it is due to the custom toolbar that I used. When a custom toolbar is set up, we also have to set a listener on the up caret using the method called drawertoggler.setNaviagtionOnClickListener

In the onCreate() method of the activity we need to add the following code:

drawertoggler.setToolbarNavigationClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getSupportFragmentManager().popBackStackImmediate();
        }
    });

Other cases like OnBackPressed can be handled by setting a OnStackChangeListener in the activity and make necessary changes. It is clearly explained here :@riwnodennyk.

Post a Comment for "Cannot Listen Clicks On Up Caret"