android - AppCompat v7 Toolbar onOptionsItemSelected not called -


I changed app compat toolbar and setup port to basic action bar (toolbar). When I am using getSupportActionBar () and setting the display for an arrow back to the left arrow, when I do not have the call, click on the OptiCity item or any other listener method.

Do I have to implement some special listener for this? Befor everything was working fine.

EDIT: Start ActionBar:

  mToolbar = (toolbar) findViewById (R.id.toolbar); SetSupportActionBar (mToolbar); MActionBar = getSupportActionBar (); MActionBar.setHomeButtonEnabled (true);  

And after changing the content with one piece, I do this:

  mDrawerLayout.setDrawerLockMode (DrawerLayout.LOCK_MODE_LOCKED_CLOSED); MDrawerToggle.setDrawerIndicatorEnabled (incorrect); MActionBar.setDisplayHomeAsUpEnabled (true);  

I know that this question has been answered but I have a real reason for the problem After 2 days of despair

Take a look at the Actionbar Drawer Toggle Documentation:

Focus on two constructors there. My mistake was that I was using another manufacturer who was taking a toolbar as a parameter. Considering the last line in the Constructors documentation, it took me so long: " If you are setting Toolbar as the actionbase of your activity, then ActionBarDrawerToggle (activity, drawer layout, int, et) After using the first constructor, the option item selected () was called with no problem.

Do not forget to call ActionBarDrawerToggle.onConfigurationChanged and onOptionsItemSelected () is described in the last part of your activity:


Comments