I'm learning about fragments I have some doubts. Consider following code:
FragmentManager fm = getFragmentManager();
Fragment MyFragment = new Fragment();
fm.beginTransaction().replace(R.id.my_container, MyFragment).addToBackStack(null).commit();
My question is:
- what exactly does replace do?
- What happens if I create many fragments this way (to replace previous ones in a container).
- Can it in any way be bad for memory usage?
- Is it considerably better just to change fragment's content?