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 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛