V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Registering
V2EX  ›  问与答

Android, listview 加载大量数据,大家会把一些数据先回收,需要时再拿回来吗

  •  
  •   Registering · Dec 27, 2015 · 1701 views
    This topic created in 3774 days ago, the information mentioned may be changed or developed.

    无论使用 arraylist 这种数据结构,还是使用 cursor ,数据过多都会出问题,比如 5w 条

    arraylist 是因为内存爆了, cursor 是因为 cursorwindow 限制只能查询的数据 1w 条左右,

    那么我们是否需要回收部分数据,

    比如从第 1 条滑到第 10000 条,,
    前 50 条查询一次,
    然后到 50-100 条时,查询加载 50-100 ,回收 1-50 ,
    然后到 100-150 条时,查询加载 100-150 ,回收 50-100
    一直这样循环下去,,

    但是有个问题,向下拉需要让用户等待加载新数据很正常,但是往回拉,还需要让用户感受到等待加载数据就很奇怪了,因为用户刚刚看过这些数据了,,

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5845 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 01:52 · PVG 09:52 · LAX 18:52 · JFK 21:52
    ♥ Do have faith in what you're doing.