List of utility methods to do Cursor Read
int | getIntFromCursor(Cursor cursor, String columnName) get Int From Cursor return cursor.getInt(cursor.getColumnIndex(columnName));
|
String | getStringFromCursor(Cursor cursor, String columnName) get String From Cursor return cursor.getString(cursor.getColumnIndex(columnName));
|
int | getPositionById(Cursor cursor, long theTargetId) get Position By Id int theWantedPosition = -1; if (cursor != null && theTargetId > 0) { if (cursor.moveToFirst()) { while (!cursor.isAfterLast()) { if (cursor.getLong(0) == theTargetId) { theWantedPosition = cursor.getPosition(); break; cursor.moveToNext(); return theWantedPosition; |
MatrixCursor | newClosedCursor() Creates new cursor, closes it and returns it ^ MatrixCursor cursor = new MatrixCursor(new String[0]); cursor.close(); return cursor; |
Date | getDate(Cursor cursor, String columnName) get Date String dateString = cursor.getString(cursor .getColumnIndex(columnName)); if (dateString == null) { return null; DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH); Date date = null; ... |