hey I m using cursor for query database by all mean but the is not pointing to any row i,e while debugging it show mrowId = null ,count =70 (what i inserted using content value is there) but when i write cursor.moveToNext() or cursor.moveToFirst(); it throws cursor index out of bound exception while cursor.moveToNext() or cursor.moveToFirst() always return in watch expression in eclipse ....... I hope you understand the problem help me in solving the issue...... thanks for your suggestion in advanced
for simplicity I am pasting code
public Cursor getDataBaseCursor(String tableName) {
Cursor cursor = null;
try {
if (mainDatabase.isOpen()) {
String countQuery = "SELECT * FROM " + tableName;
cursor = mainDatabase.rawQuery(countQuery, null);
// cursor = mainDatabase.query(tableName, null, null, null,
// null, null, null);
if (cursor != null) {
**boolean check =cursor.moveToNext();**
return cursor;
}
} else {
createOrOpenDatabase(databaseName);
cursor = mainDatabase.query(tableName, null, null, null, null, null, null);
if (cursor != null) {
cursor.moveToFirst();
return cursor;
}
}
} catch (Exception e) {
e.printStackTrace();
cursor = mainDatabase.query(tableName, null, null, null, null, null, null);
if (cursor != null) {
cursor.moveToNext();
return cursor;
}
}
return null;
}
the boolean check is true while debugging