0
I have this method that checks the Fragment inflate in my view:
private void startFragment(int code) {
switch (code) {
case 1:
fragmentTransaction.replace(R.id.fragment, MesAnterior.newInstance(0));
break;
case 2:
fragmentTransaction.replace(R.id.fragment, MesAtual.newInstance(1));
break;
case 3:
fragmentTransaction.replace(R.id.fragment, MesProximo.newInstance(2));
break;
}
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}
I have a Fragment (xml) that will receive Fragment.
at the first click on the button it goes smoothly, but at the second it gives the error commit already called