调用cursor的getString方法(参考代码见下面)
在while循环里,如果cursor.moveToNext()能移动到下一条
就代表游标对象里有数据。然后调用cursor的getString()方法把cursor的复制给字符串。
public ListfindAll() {
SQLiteDatabase db = helper.getReadableDatabase();
ListblackBeans = new ArrayList ();
Cursor cursor = db.query("blackNumber", new String[]{"number", "mode"}, null, null, null, null, null);
while (cursor.moveToNext()) {
BlackBean blackNumberInfo = new BlackBean();
blackNumberInfo.setNumber(cursor.getString(0));
blackNumberInfo.setMode(cursor.getString(1));
blackBeans.add(blackNumberInfo);
}
cursor.close();
return blackBeans;
}