The code to returns all the data in the table in list.But this isn t working. I ve called this method from CheckData class which is called by main class
public List<String[]> selectAll() {
List<String[]> list = new ArrayList<String[]>();
Cursor cursor = db
.query(TABLE_NAME, null, null, null, null, null, null);
int x = 0;
if (cursor.moveToFirst()) {
do {
String[] b1 = new String[] { cursor.getString(1),
cursor.getString(2) };
list.add(b1);
x = x + 1;
} while (cursor.moveToNext());
}
if (cursor != null && !cursor.isClosed()) {
cursor.close();
}
cursor.close();
return list;
}
我的数据库有三栏:id(主要钥匙)、文号(文本)和公司名称(文本)。
我的数据 基地名称是亚洲开发银行,表名是简易的。