There is a FragmentManager, it manages two structures: such as the transaction stack and the list of fragments.
And I'm trying to understand what these structures are?
Here is an example code
Fragment fragment = fm.findFragmentById(R.id.fragmentContainer); if(fragment == null){ fragment = new CrimeFragment(); fm.beginTransaction() // Создать новую транзакцию фрагментов .add(R.id.fragmentContainer,fragment) // добавляем фрагмент в списрк .commit(); // закрепляем }
As a result, this code does the following:
Getting an existing fragment by the container view ID. (From the beginning, we will send a fragment with the container identifier from FragmentManager. If this fragment is already in the list, FragmentManager returns it. // What is this fragging ??
Question: what if there are several of these fragments? How will he return a few?
So, if fragment == null, then we create a fragment, create a new transaction, and add the fragment to the list of fragments, then close it.
What then is a transaction stack?