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 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿