Closed passsy closed 6 years ago
Reported: https://issuetracker.google.com/issues/111131656 //cc @sockeqwe
Possible workaround (not tested if returns the correct result)
public static boolean isInBackStack(final Fragment fragment) {
// Hacky workaround because Fragment#isInBackStack is inaccessible with AndroidX
final StringWriter writer = new StringWriter();
fragment.dump("", null, new PrintWriter(writer), null);
final String dump = writer.toString();
return !dump.contains("mBackStackNesting=0");
}
Thanks for the info.
I talked to Adam Powell about making isInBackStack()
public some time ago but I as well as Adam haven't push this further. I will reach out to him.
On Android P (Preview 3) with AndroidX