Fixed
Status Update
Comments
dn...@google.com <dn...@google.com> #2
We have passed this to the development team and will update this issue with more information as it becomes available.
is...@google.com <is...@google.com>
il...@google.com <il...@google.com> #3
Yep, looks like we're still missing the Fragment name (i.e., this) in error messages thrown from within Fragment's instantiateChildFragmentManager
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit bbecf43abd40d186b332a96ba3a6534264770a32
Author: jbwoods <jbwoods@google.com>
Date: Fri Mar 08 14:36:12 2019
Add Fragment name to instantiateChildFragmentManager() Error Message
Added the Fragment name (i.e. this) to the error message when a fragment
has not been attached and when a fragment does not have a view.
Test: The associated tests have been added and the unit tests run
BUG: 67759402
Change-Id: I0f75530189a0cc8d10947936ba7194d0db63e4b0
M fragment/src/androidTest/java/androidx/fragment/app/FragmentTest.kt
M fragment/src/main/java/androidx/fragment/app/Fragment.java
https://android-review.googlesource.com/924294
https://goto.google.com/android-sha1/bbecf43abd40d186b332a96ba3a6534264770a32
Branch: androidx-master-dev
commit bbecf43abd40d186b332a96ba3a6534264770a32
Author: jbwoods <jbwoods@google.com>
Date: Fri Mar 08 14:36:12 2019
Add Fragment name to instantiateChildFragmentManager() Error Message
Added the Fragment name (i.e. this) to the error message when a fragment
has not been attached and when a fragment does not have a view.
Test: The associated tests have been added and the unit tests run
BUG: 67759402
Change-Id: I0f75530189a0cc8d10947936ba7194d0db63e4b0
M fragment/src/androidTest/java/androidx/fragment/app/FragmentTest.kt
M fragment/src/main/java/androidx/fragment/app/Fragment.java
il...@google.com <il...@google.com> #5
This is fixed internally and will be available in Fragments 1.1.0-alpha06
Description
MainActivity}: java.lang.IllegalStateException: Fragment has not been attached yet.
Really helpfull exception...
Fragment.java:
void instantiateChildFragmentManager() {
if (mHost == null) {
throw new IllegalStateException("Fragment has not been attached yet.");
}
mChildFragmentManager = new FragmentManagerImpl();
mChildFragmentManager.attachController(mHost, new FragmentContainer() {
@Override
@Nullable
public View onFindViewById(int id) {
if (mView == null) {
throw new IllegalStateException("Fragment does not have a view");
}
return mView.findViewById(id);
}
@Override
public boolean onHasView() {
return (mView != null);
}
@Override
public Fragment instantiate(Context context, String className, Bundle arguments) {
return mHost.instantiate(context, className, arguments);
}
}, this);
}
So please just add stupid name of fragment to log like in my gist: