我有一个我想在列表视图中显示的数据库。我有事要做。继承人的代码:
Cursor cursor = myDataBase
.rawQuery(
"SELECT * FROM Accelerometer where cur_timestamp<'2012-09-04 11:36:25'",
null);
while (cursor.moveToNext()) {
// Which column you want to exprort
String arrStr[] = { cursor.getString(0)+" | " + cursor.getString(1)+" | " + cursor.getString(2)+" | "+ cursor.getString(3)+" | " + cursor.getString(4)+"\n" };
if (arrStr.length != 0) {
Log.d("TravellerLog :: ", Arrays.toString(arrStr));
//data.setText(Arrays.toString(arrStr));
ListView listView = (ListView) findViewById(R.id.listView1);
// a listát berakni aegy arraylist-be
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1,
arrStr);
listView.setAdapter(adapter);
} else {
Log.e("TravellerLog :: ", "Üres a tömb!");
}
}
cursor.close();
我应该在代码中进行哪些更改才能使其正常工作?列出我想要的所有行非常感谢您的回答!