如何在我的内容提供者中获取 _count? [英] How do I get the _count in my content provider?

查看:18
本文介绍了如何在我的内容提供者中获取 _count?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该怎么做才能让我的内容提供者返回带有记录计数的 _count 列?文档说它是自动的,但也许它只需要一些内置的内容提供者.对数据库运行查询似乎不会返回它.

What should I do to get my content provider to return the _count column with the count of records? The documentation says it is automatic, but maybe it's only taking about some built-in content provider. Running a query to the database seems not to return it.

推荐答案

如果您使用的是 ContentProvider.query(),则返回一个 Cursor.调用 Cursor.getCount() 获取返回游标中的记录数.

If you are using ContentProvider.query() a Cursor is returned. Call Cursor.getCount() to get a count of records in the returned cursor.

这篇关于如何在我的内容提供者中获取 _count?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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