Open jeonhei opened 5 years ago
最近更新到了1.3.7的版本 之前使用开的继承了自定义SupportActivity的页面通通报 java.lang.ClassCastException: xxx cannot be cast to me.yokeyword.fragmentation.SupportActivity
java.lang.ClassCastException: xxx cannot be cast to me.yokeyword.fragmentation.SupportActivity
看了下源码发现是SupportFragment的onAttach里加上了强制转换语句报错的 @Override public void onAttach(Activity activity) { super.onAttach(activity); mDelegate.onAttach(activity); _mActivity = (SupportActivity) mDelegate.getActivity(); }
@Override public void onAttach(Activity activity) { super.onAttach(activity); mDelegate.onAttach(activity); _mActivity = (SupportActivity) mDelegate.getActivity(); }
不明白作者为什么这么做 求解决
因为好多逻辑都是配合SupportActivity才可以完成,并且确实本库的activity 的基类扩展性差了点,作者也好久不管这个了,如果谁有精力,其实可以吧SupportActivity的逻辑封装扩展,让使用者不必去继承SupportActivity,这是本库确实存在的不足
解决方法,详见 https://github.com/JantHsueh/Fragmentation/issues/1
最近更新到了1.3.7的版本 之前使用开的继承了自定义SupportActivity的页面通通报
java.lang.ClassCastException: xxx cannot be cast to me.yokeyword.fragmentation.SupportActivity
看了下源码发现是SupportFragment的onAttach里加上了强制转换语句报错的
@Override public void onAttach(Activity activity) { super.onAttach(activity); mDelegate.onAttach(activity); _mActivity = (SupportActivity) mDelegate.getActivity(); }
不明白作者为什么这么做 求解决