-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
Bug Description:
Related Code:
@Override
public Object instantiateItem(ViewGroup container, int position) {
Fragment f = (Fragment) super.instantiateItem(container, position);
View view = f.getView();
if (view != null)
container.addView(view);
return f;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
View view = mList.get(position).getView();
if (view != null)
container.removeView(view);
}
分析原因
当切换viewpager会执行上面的2个方法,如果执行了destroyItem() 则在页面跳转时候(比如跳转到其他Activity)会发生crash
原因应该是 viewpager会在跳转前执行removeViews()方法,导致NullPointerException 不知道我分析得对不对
最后感谢作者提供这么好的框架给我们学习
Bug Log:
Others:
Metadata
Metadata
Assignees
Labels
No labels
