Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加载10000条数据 #27

Open
Allen-cxl opened this issue Apr 18, 2019 · 3 comments
Open

加载10000条数据 #27

Allen-cxl opened this issue Apr 18, 2019 · 3 comments

Comments

@Allen-cxl
Copy link

加载10000条数据,App直接ANR了。有什么办法解决的吗?

@xiangcman
Copy link
Owner

xiangcman commented Apr 18, 2019 via email

@Allen-cxl
Copy link
Author

后来我重新看了下,又没有出现anr。出现了下面问题:
1.空指针crash
2.上下快速滑动会卡顿,布局会重叠
java.lang.NullPointerException: Attempt to read from field 'int android.graphics.Rect.bottom' on a null object reference at com.test.toastdemo.FlowLayoutManager.fill(FlowLayoutManager.java:191)
at com.test.toastdemo.FlowLayoutManager.scrollVerticallyBy(FlowLayoutManager.java:241)
at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4680)

代码片段:
RecyclerView.setLayoutManager(new FlowLayoutManager());
RecyclerView.setAdapter(new RecycleViewAdapter(this, Data.foods()));
public static List foods(){
List foods =new ArrayList<>();
Data food = null;
for (int i = 0 ; i < 10000 ; i++){
food = new Data("recycle"+"("+i+")");
foods.add(food);
}
return foods;
}

@xiangcman
Copy link
Owner

xiangcman commented Apr 29, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants