Nick Kahn
Nick Kahn

Reputation: 20078

Caching query in SQLite?

  Cursor _cursor;
        public Cursor GetCursor()
        {
            return _cursor;     
        }
        public void SetCursor(Cursor cursor)
        {
            this._cursor = cursor;      
        }

    if (GetCursor() == null)
    {
      SetCursor(queueAll());
    }

UPDATE:

Is there any mechanism to keep query results in order to reuse them the next time this query occurs?

here is my query:

public Cursor queueAll(){
        String[] columns = new String[]{KEY_ID, KEY_CONTENT};
        Cursor cursor = sqLiteDatabase.query(MYDATABASE_TABLE, columns,
                null, null, null, null, null);

        return cursor;
    }

Upvotes: 1

Views: 1191

Answers (1)

user1296082
user1296082

Reputation: 171

The return Cursor is the one you want to save. Just create a Cursor object and save the return value

Upvotes: 1

Related Questions