I am adding a fragment B on top of another fragment A as follows:
fragmentManager.beginTransaction().add(R.id.frame_container, fragment).addToBackStack("post_details").commit();
The issue is, when I click on device back on B, I need an anchor in A. Which lifecycle method will be called in this case?