SQLite Getting only last record not all the Records

后端 未结 3 1851
臣服心动
臣服心动 2020-12-20 11:05

I have total 4 records in ecare table, where 2 records status is sent = 1, and other 2 records status is

3条回答
  •  礼貌的吻别
    2020-12-20 11:22

    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.

提交回复
热议问题