In android Coding I have some doubts.I am working In Paging concepts. I have two Fragments. One is Master Fragment and another one is Transaction Fragment. In master one Button is available. That is vendor. If we click the vendor button we can create a new vendor details. Its work fine to move forward. That is if we click the vendor button the next page is opened. But if return backward by pressing it doesn't work. By pressing the back button from new vendor creation to vendor it works. But if we press back button from vendor to Pager fragment it does n't work. Here I have attached the coding and screen shots. Please help me. Thanks in advance.
Screen Shots
Master Transaction Vendor Vendor Creation The following is the code when we click the backbutton
Fragment fragment = new MainActivity();
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.frag_act_cont, fragment, "Class Name").commit();