Suppose I want to replace the current fragment as a container with another. Better use a replacement ...
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.fragment_container, newFragment, null); ft.commit();
... or the following, with show and hide?
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.hide(oldFragment); ft.show(newFragment); ft.commit();
One way to make this more efficient? It is not possible to find much information about when to use these methods or how they affect the life cycle of fragments. Thank!
android android-fragments
Robert Karl Oct 31 2018-12-12T00: 00Z
source share