是谁的方法?
人生最曼妙的风景,竟是内心的淡定与从容!
自问自答~,作为范例 这个方法是Fragment的方法,用来在Fragment上管理Fragment; 使用时,如果用的V4包,会碰到no Activity错误,是因为v4包没重置childFragmentManager,重写父Fragment的onDetch方法,来解决:
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); } }`
参考资料:http://www.tuicool.com/articles/2eM32ahttp://stackoverflow.com/questions/15207305/getting-the-error-java-lang-illegalstateexception-activity-has-been-destroyed
自问自答~,作为范例
这个方法是Fragment的方法,用来在Fragment上管理Fragment;
使用时,如果用的V4包,会碰到no Activity错误,是因为v4包没重置childFragmentManager,重写父Fragment的onDetch方法,来解决:
参考资料:
http://www.tuicool.com/articles/2eM32a
http://stackoverflow.com/questions/15207305/getting-the-error-java-lang-illegalstateexception-activity-has-been-destroyed