Android examples for Database:SQL Query
get Page Sorted By Key from database table
//package com.book2s; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { public static final int PAGE_SIZE = 50; public static Cursor getPageSortedByKey(SQLiteDatabase db, String tableName, String keyColumn, boolean desc, int pageNum) { return db.rawQuery("SELECT * " + "FROM " + tableName + " " + "ORDER BY " + keyColumn + " " + (desc ? "DESC" : "") + " " + "LIMIT " + PAGE_SIZE + " " + "OFFSET " + (PAGE_SIZE * pageNum) + ";", null); }/* ww w . jav a2 s . com*/ }