Search code examples
sqlandroiddatabasesqlitemobility

How to fetch records in pages in Android


I want to use the SQLite clause LIMIT and OFFSET, so that I can fetch my records in pages. But, though I can find the LIMIT clause in the SQLiteQueryBuilder.query() which would effectively limit the number of record in my result. Couldn't find the OFFSET clause anywhere so that I can continue fetching from the point I left. Also, can someone explain to me the exact use of SelectionArgs[] in the query() function, with some example?


Solution

  • You can just give the Limit and Offset parameters in the where clause , in this way

    tmpCol.query(Tablename, columns, "WHERE Clause LIMIT xx OFFSET yy",
                                    selectionArgs[], having, orderBy);