如何在Android的限制条款添加到manageQuery [英] how add limit clause to manageQuery on android

查看:232
本文介绍了如何在Android的限制条款添加到manageQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android的API提供了通过SQLite的清洁机制,使查询到联系人列表。但是,我不知道如何限制的结果:

Android's API provides a clean mechanism via SQLite to make queries into the contact list. However, I am not sure how to limit the results:

Cursor cur = ((Activity)mCtx).managedQuery(
                People.CONTENT_URI,
                columns,
                "LIMIT ? OFFSET ?",
                new String[] { Integer.toString(limit), Integer.toString(offset) },
                null
        );

不能正常工作。

Doesn't work.

推荐答案

其实,根据不同的供应商,你可以按如下附加限制到URI:

Actually, depending on the provider you can append a limit to the URI as follows:

uri.buildUpon().appendQueryParameter("limit", "40").build()

我知道MediaProvider处理这和看近code似乎可以与联系人也做到这一点。

I know the MediaProvider handles this and from looking at recent code it seems you can do it with contacts too.

这篇关于如何在Android的限制条款添加到manageQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆