我是新來的android編程。片段有目標不在片段管理器
我只是試圖在我的片段中保存ListView
的狀態。爲此,我遵循無頭碎片(沒有UI的片段)。在這個片段中,我保存了ListView
中使用的數據,並從主片段(具有UI的片段)開始無頭片段。
現在,我得到異常:
java.lang.IllegalStateException: Failure saving state: RetainedFragment{4161f850 #1 work} has target not in fragment manager: JobOpeningFramgent{41601c00}
據我所關注的,這是當我試圖用另一個在DrawerLayout
更換片段發生。
請諒解此例外的原因,以便更好地理解。
謝謝。
Boopathy。
發表您的code.I假設您有一個擴展Fragment的類和一個使用setRetainInstance(true)擴展Fragment的其他靜態內部類! 然後你調用innerClass.setTargetFragment。 當外層碎片被破壞時會發生什麼? 的源代碼[這裏](http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.1_r1/android/support/v4/app/FragmentManager。 java#FragmentManagerImpl.saveAllState%28%29) – Davide