如何将数组列表中的每第10行插入? 这是我的代码:
openDB();
Cursor c = myDb.getSpalte();
List<Integer> valueList = new ArrayList<Integer>(c.getCount());
while (c.moveToNext()) {
valueList.add(c.getInt(1));
}
c.close();
closeDB();
答案 0 :(得分:1)
openDB();
Cursor c = myDb.getSpalte();
List<Integer> valueList = new ArrayList<Integer>(c.getCount());
List<Integer> tenthRows = new ArrayList<Integer>();
counter = 0;
while (c.moveToNext()) {
Integer value = c.getInt(1);
valueList.add(value );
counter++;
if(counter == 10) {
tenthRows.add(value)
counter = 0;
}
}
c.close();
closeDB();