I have total 4 records in ecare table, where 2 records
status is sent = 1, and other 2 records status is
Your missing startManagingCursor()
method.
Cursor cursor = db.rawQuery(sql, null);
cursor.getCount();
startManagingCursor(cursor);//the important line
cursor.moveToFirst();
if(cursor.getCount() == 0)
{
//error no records
}
else
{
for(int i=0;i
NOTE:
startManagingCursor()
is deprecated because it does operations on the main thread which can freeze up the UI and deliver a poor user experience. You should use a CursorLoader
with a LoaderManager
instead.