Go from one fragment to another through a button

0

Good I have Navegation Drawer inside of it I have a fragment that is activated when I click on gallery (which is in the slide bar by default), inside that fragment I have a button, my question is, how can I show another new fragment by pressing that button (eye: the button is inside the fragment). I do not know if you explain me well

this button with id btneditperf is in my fragment and for the buttons to work, I mean join them with a variable I made with the View

View rootView;
Button btneditperf;
-----------------
btneditperf = (Button) rootView.findViewById(R.id.btneditperf);
------------------

Try the following but my application stops

btneditperf.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Fragment nuevoFragment = new BlankFragment();
            FragmentTransaction transaction = getFragmentManager().beginTransaction();
            transaction.replace(R.id.content_perfil, nuevoFragment);
            transaction.addToBackStack(null);
            transaction.commit();
        }
    });
    
asked by kevvelas 28.11.2017 в 00:42
source

0 answers