1 Dodaj dwa fragmenty do FragmentManagerFragment nadal istnieje po usunięciu?
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft1 = fm.beginTransaction();
ft1.add(containerId, fragment1, "fragment1");
ft1.addToBackStack(null);
ft1.commitAllowingStateLoss();
FragmentTransaction ft2 = fm.beginTransaction();
ft2.add(containerId, fragment2, "fragment2");
ft2.addToBackStack(null);
ft2.commitAllowingStateLoss();
2 Zmień ustawienia mobilne Developer Opcje-> Nie przechowywać AktywnoĹ> ON
3 Usuń wszystkie fragmenty po działalność została odtworzona
FragmentTransaction ft3 = fm.beginTransaction();
for(Fragment f : fm.getFragments()) ft3.remove(f);
ft3.commitAllowingStateLoss();
Moje pytanie brzmi, dlaczego fm.findFragmentByTag ("fragment1") NIE ma wartości NULL po usunięciu?
minSdkVersion 17 targetSdkVersion 22 compileSdkVersion 22
działa jak uroku! – wonsuc