Disable second click on NavigationDrawer

1

I am developing an application, which contains one menu drawer , however, I'm a multitoque problem, ie when the user selects an item, and quickly selects again, it keeps drawer aberto .

I would like that when the user selects an item, drawer will close, and ignore the second click.

The event I treat today is like this

exp_list_fragments.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
            @Override
            public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {

                if (groupPosition == 3 && childPosition > 0) {
                    switch (childPosition) {
                        case 1:
                            logoutApplication(false);
                            break;
                        case 2:
                            DialogSendEmail d = new DialogSendEmail(Activity_Main.this);
                            d.show();
                            break;
                        case 3:
                            rt.questionExitSystem();
                            break;
                    }
                } else {
                    Child_Fragments child_fragment = group_fragments.get(groupPosition).getFragments().get(childPosition);
                    controller.setActionBarTitle(child_fragment.getTitle(), child_fragment.getIcone());
                    supportInvalidateOptionsMenu();
                    getSupportFragmentManager().beginTransaction().replace(R.id.layout_drawer_content,
                            child_fragment.getFragment()).commit();
                }
                setFragmentSelection(groupPosition, childPosition);
                layout_drawer.closeDrawer(layout_drawer_drawer);
                return false;
            }
        });
    }
    
asked by anonymous 23.02.2015 / 13:39

1 answer

0

Hello,

At the end of the onChildClick method change return false; to return true; . This causes the OS to no longer handle this click captured in any of the next method of the listeners hierarchy ... just as your method has already "handled" the event, you do not want any future treatments ...

    
14.03.2015 / 01:15