即使光标中有数据,我也会收到带有“prntln 需要消息”错误的 NullPointerException。我可能在这里缺少什么?
databaseHelper = new DatabaseHelper(this);
db = databaseHelper.getWritableDatabase();
Cursor c = db.rawQuery("SELECT name, group FROM " +
"groupWorksheet", null);
if (c != null ) {
if (c.moveToFirst()) {
Log.v(TAG, "has data");
do {
String myName = c.getString(c.getColumnIndex("name"));
Log.v(TAG, myName);
}while (c.moveToNext());
}
}else {
Log.v(TAG, "no data");
}