I have a fragment and an onTouch event to switch to another fragment
            public boolean onTouch(View v, MotionEvent event) {
                int x = (int)event.getRawX();
                int y = (int)event.getRawY();
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    FragmentManager fm = getActivity().getSupportFragmentManager();
                    FragmentTransaction ft = fm.beginTransaction();
                    ft.replace(R.id.fragment_stars, fragment);
                    ft.addToBackStack(null);
                    ft.commit();
                }
                return false;
            }
But the icon in the sidebar doesn't change, it stays in the parent fragment I tried to set checked in onCreateOptionsMenu but no work Also I add setHasOptionsMenu(true); in onCreateView
    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){
        inflater.inflate(R.menu.sidebar, menu);
        MenuItem item  = menu.findItem(R.id.sistemFragment);
        item.setChecked(true);
        super.onCreateOptionsMenu(menu, inflater);
    }
sistemFragment is fragment I point to, but it doesn't change the cheched, it stays in the parent fragment

                        
Finally I have solved it with NavigationUI, I'm not sure if it's the right way, but it works