Skip to content

加载10000条数据 #27

Open
Open

Description

@Allen-cxl

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

Activity

  1. xiangcman commented on Apr 18, 2019

    @xiangcman
    Owner
  2. Allen-cxl commented on Apr 26, 2019

    @Allen-cxl
    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;
    }

  3. xiangcman commented on Apr 29, 2019

    @xiangcman
    Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions