Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 3905584b8c5d63aeb50a4de9a44b48ca029435a8
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Jan 21 14:55:03 2020
Ensure findFragment works with <fragment> tag
When calling FragmentManager.findFragment() with the view of a fragment
that was added using the <fragment> tag, that fragment was being ignored
(either the parentFragment was found or it was crashing saying the view
did not have a fragment set).
This change sets the proper view tag on <fragment> tag inflated
fragments.
Test: Added test
Bug: 147784323
Change-Id: I4346b694ba2af1fab1f68a879df96beaf129cd0c
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentViewTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
https://android-review.googlesource.com/1214539
Branch: androidx-master-dev
commit 3905584b8c5d63aeb50a4de9a44b48ca029435a8
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Jan 21 14:55:03 2020
Ensure findFragment works with <fragment> tag
When calling FragmentManager.findFragment() with the view of a fragment
that was added using the <fragment> tag, that fragment was being ignored
(either the parentFragment was found or it was crashing saying the view
did not have a fragment set).
This change sets the proper view tag on <fragment> tag inflated
fragments.
Test: Added test
Bug: 147784323
Change-Id: I4346b694ba2af1fab1f68a879df96beaf129cd0c
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentViewTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
jb...@google.com <jb...@google.com> #3
This has been addressed internally, and will be available in the Fragment 1.2.1 release.
Description
Version used: 1.2.0-rc05
When called on a view within a fragment added with a <fragment> tag in a layout, FragmentManager.findFragment(view) returns either the containing fragment's parent, or crashes as it can not find any parent fragment.
I've attached a sample project which crashes on startup due to the bug. Replacing the <fragment> tag with FragmentContainerView or a framelayout with a manual transaction avoids the crash