ContentResolver で、LIMIT句のクエリを実行する場合、Uriのパラメータ追加でなくて、
query メソッドの sortOrder パラメータに書いた方が良い。
以下のように、Uri の appendQueryParameter を実行して 再 build するものと思っていたのだが、、、
Cursor cursor = context.getContentResolver().query(
ContactsContract.Data.CONTENT_URI
.buildUpon().appendQueryParameter("limit", "10")
.appendQueryParameter("offset", "20")
.build()
, projection
, selection
, selectionArgs
, RawContacts.CONTACT_ID + " ASC
");
これは、期待どおりに offset がうまく働かない。
query メソッドの sortOrder に書いてしまう方がうまくいく。
Cursor cursor = context.getContentResolver().query(
ContactsContract.Data.CONTENT_URI
, projection
, selection
, selectionArgs
, RawContacts.CONTACT_ID + " ASC limit 10 offset 20"
);