指定限制/对的ContentProvider查询偏移 [英] Specifying limit / offset for ContentProvider queries
本文介绍了指定限制/对的ContentProvider查询偏移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让我的ContentResolver的运行这个查询:
I'm trying to get my ContentResolver to run this query:
select * from myTable limit 1 offset 2
唯一的查询在ContentResolver的方法是:
The only query method in ContentResolver is:
resolver.query(uri, projection, selection, selectionArgs, sortOrder);
我已经试过:
I've tried:
final Cursor c = resolver.query(
MyTable.CONTENT_URI,
MyTable.PROJECTION,
" ? ?",
new String[] {"1", "2"},
null);
刚刚抛出IllegalArgumentException。 什么是实现这一目标的正确方法是什么?
Which just throws an IllegaLArgumentException. What is the correct way of achieving this?
推荐答案
我把在sordOrder参数LIMIT子句,我也看到了同样的事情,别人做,但不知道其100%正确的:
I put the LIMIT clause in the sordOrder parameter, I've also seen the same thing done by others but not sure if its 100% correct:
final Cursor c = resolver.query(
MyTable.CONTENT_URI,
MyTable.PROJECTION,
null,
null,
" limit 1 offset 2");
这篇关于指定限制/对的ContentProvider查询偏移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文