Пример #1
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   if (!navigationDrawerFragment.isDrawerOpen()) {
     // Only show items in the action bar relevant to this screen
     // if the drawer is not showing. Otherwise, let the drawer
     // decide what to show in the action bar.
     getMenuInflater().inflate(R.menu.main, menu);
     restoreActionBar();
     return true;
   }
   return super.onCreateOptionsMenu(menu);
 }
Пример #2
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Get item selected and deal with it
    switch (item.getItemId()) {
      case android.R.id.home:
        // called when the up affordance/carat in actionbar is pressed
        mActivity.getNavigationDrawerFragment().setDrawerIndicatorEnabled(true);
        mActivity.restoreActionBar();
        getActivity().getSupportFragmentManager().popBackStack();
        return true;
    }

    return super.onOptionsItemSelected(item);
  }