Subratsss
4/5/2018 - 11:10 AM

Menu item Functionality

Activity---->Fragment menu item's show First of all define toolbra in activity

 //For Menu item operation
 @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() == R.id.create_group) {

            SelectionDialogFragment groupSelectionDialogFragment = SelectionDialogFragment.groupSelectionDialogInstance(BillConstants.CREATE_GROUP);
            groupSelectionDialogFragment.show(getChildFragmentManager(), BillConstants.DIALOG_TAG);
        }
        if (menuItem.getItemId() == R.id.add_in_group) {

            SelectionDialogFragment groupSelectionDialogFragment = SelectionDialogFragment.groupSelectionDialogInstance(BillConstants.ADD_IN_GROUP);
            groupSelectionDialogFragment.show(getChildFragmentManager(), BillConstants.DIALOG_TAG);

        }

        return super.onOptionsItemSelected(menuItem);
    }
  //For Menu item define
 @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.vendorcustomer_menu, menu);
        addIntoGroup_Menu = menu.findItem(R.id.add_in_group);
        createGroup_Menu = menu.findItem(R.id.create_group);


        super.onCreateOptionsMenu(menu, inflater);
    }

   
 private MenuItem addIntoGroup_Menu, createGroup_Menu;

 @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_customer_list, container, false);

        setHasOptionsMenu(true);/for showing in fragment
                               
                               
                               
                               
                             }