0
votes
  1. I'm trying below code to replace the new fragment, but it's not Replaced.

    android.app.Fragment Manager fragmentManager = ((Activity) context). getFragmentManager(); android.app.FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction(); fragmentTransaction.add(R.id.frame_container, menuItemDetailsFragment); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit();

1
Do you mean navigating From one fragment to another ?Ahlem Jarrar
stackoverflow.com/questions/5658675/… check this and see if it answers your problemAhmed Saad Harmoush
Yes sir, when user click on the old fragment button, then opens a new fragment.Finally means replace the new fragment. I did above code but the fragments are overlapping.Kailash Karankal

1 Answers

1
votes

You actually need to use the replace function Just replace this line of code

fragmentTransaction.add(R.id.frame_container, menuItemDetailsFragment); 

with this

fragmentTransaction.replace(R.id.frame_container, menuItemDetailsFragment);