Change selected item in NavigationView when I change the fragment

0

good morning. I have a problem in which I have the NavigationView template generated by Android Studio, the items in the navigation bar are associated with a fragment, the scroll between the fragments using the navigation bar works fine, but when I want to change with a button that is in one of those fragments to another fragment, the item selected in the navigation bar is not updated and continues to point to the first fragment.

To move from one fragment to another use:

 btnResultados.setOnClickListener(new View.OnClickListener() {

        @RequiresApi(api = Build.VERSION_CODES.CUPCAKE)
        @Override
        public void onClick(View v) {
            fragmentResultados = new resultados();
            FragmentTransaction transaction = getFragmentManager().beginTransaction();
            transaction.replace(R.id.contenedorPrincipal, fragmentResultados);
            transaction.addToBackStack(null);
            transaction.commit();
        }
    });

The fragment change does it well, but the selected item is not updated in the navigation bar.

    
asked by Lucas Diaz 15.08.2018 в 13:49
source

0 answers