weimingyu_ 2016-09-07 07:51 采纳率: 0%
浏览 1171

遍历数据库,如果数据很多这个arraylist是不是会崩啊!要怎么解决啊?

//遍历所有账单 private void selectAll(){ List list=new ArrayList(); ListDBAdapter adapter=new ListDBAdapter(this,list); listView.setAdapter(adapter); //数据库的列数 int count=dbUtil.select().getColumnCount(); //获得的数据库游标 Cursor c=dbUtil.select(); while (c.moveToNext()){ OrderHistory history=new OrderHistory(); for (int i = 0; i < count; i++) { history.set_id(c.getInt(0)); history.setPay_number(c.getString(1)); history.setAmount_paid(c.getDouble(2)); history.setTaam(c.getDouble(3)); history.setOrder_amount(c.getDouble(4)); history.setBilling_method(c.getInt(5)); history.setBilling_number(c.getString(6)); history.setDate(c.getString(7)); history.setTimestamp(c.getLong(8)); history.setPayee(c.getString(9)); history.setIntegral(c.getInt(10)); history.setIs_sync(c.getInt(11)); history.setPay_state(c.getInt(12)); history.setIs_print(c.getInt(13)); history.setMonth(c.getInt(14)); history.setDay(c.getInt(15)); } list.add(history); }

  • 写回答

2条回答

  • threenewbee 2016-09-07 20:18
    关注

    看你多到什么程度,几万条几十万条肯定不会,最多就是消耗的内存多一些吧。

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器