Monday, September 12, 2011

[android-developers] Idiomatic way of getting count of items in content provider directory

For both writing a content provider, and using an existing one, what
is the preferred way of getting the number of items in a directory?

For example
content://foo/bar

I would like to know how many items are in bar. I could select all of
the rows and then call Cursor.getCount() but that seems terrible.

If I am writing my own Content Provider, I suppose I could add a Uri
in my content provider like

content://foo/bar/count

which return a ResultSet containing select(*) from bar, essentially.

Thanks

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment