Ask and answer your own questions~, as an example
This method is a Fragment method, used to manage Fragment on Fragment;
When using, if you use the V4 package, you will encounter a no Activity error. This is because the v4 package does not reset the childFragmentManager. Override the onDetch method of the parent Fragment to solve the problem:
public void onDetach() {
super.onDetach();
try {
Field childFragmentManager = Fragment.class.getDeclaredField("mChildFragmentManager");
childFragmentManager.setAccessible(true);
childFragmentManager.set(this, null);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}`
Ask and answer your own questions~, as an example
This method is a Fragment method, used to manage Fragment on Fragment;
When using, if you use the V4 package, you will encounter a no Activity error. This is because the v4 package does not reset the childFragmentManager. Override the onDetch method of the parent Fragment to solve the problem:
References:
http://www.tuicool.com/articles/2eM32a
http://stackoverflow.com/questions/15207305/getting-the-error-java -lang-illegalstateexception-activity-has-been-destroyed