如何在Android中使用联系人列表分页

如何在Android中使用联系人列表分页,android,android-contentprovider,android-architecture-components,android-contentresolver,android-paging-library,Android,Android Contentprovider,Android Architecture Components,Android Contentresolver,Android Paging Library,我试图使用分页库在RecyclerView中显示具有搜索功能的联系人。我关注这个GitHub项目。以下是我的项目中的代码片段。我正在尝试使用pagedList适配器逐渐获取联系人。但在某些Android版本(如Android 9.0)中,这种限制和偏移并没有像预期的那样起作用。除此之外还有其他选择吗 private val PROJECTION = arrayOf( ContactsContract.Contacts.DISPLAY_NAME,

我试图使用分页库在RecyclerView中显示具有搜索功能的联系人。我关注这个GitHub项目。以下是我的项目中的代码片段。我正在尝试使用pagedList适配器逐渐获取联系人。但在某些Android版本(如Android 9.0)中,这种限制和偏移并没有像预期的那样起作用。除此之外还有其他选择吗

private val PROJECTION = arrayOf(
                ContactsContract.Contacts.DISPLAY_NAME,
                ContactsContract.CommonDataKinds.Phone.NUMBER
        )
    val cursor = contentResolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                    PROJECTION,
                    null,
                    null,
                    ContactsContract.Contacts.DISPLAY_NAME +
                            " ASC LIMIT " + limit + " OFFSET " + offset) 
此外,我还尝试了另一种方法,如下所示

val queryArgs = Bundle()
        val cursor: Cursor?
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            queryArgs.putInt(ContentResolver.QUERY_ARG_OFFSET, offset)
            queryArgs.putInt(ContentResolver.QUERY_ARG_LIMIT, limit)

            cursor = contentResolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                    PROJECTION,
                    queryArgs,
                    null)
        } else {
            cursor = contentResolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                    PROJECTION,
                    null,
                    null,
                    ContactsContract.Contacts.DISPLAY_NAME +
                            " ASC LIMIT " + limit + " OFFSET " + offset)
        }
但对我来说什么都不管用