List Queries
Converting a whole list at one chunk can be memory intensive. This lazily creates models from a Cursor
for you and you can operate on it s if it's a list. It a acts like a list can be used in a for-loop:
Note: It's preferred within a RecyclerView
to use the QueryDataSource
with the Paging library, as this use can potentially lock the UI thread during heavy db usage.
Note: Ensure you close the FlowQueryList
when you are done using.
FlowCursorList
The FlowCursorList
is simply a wrapper around a standard Cursor
, giving it the ability to cache Model
, load items at specific position with conversion, and refresh its contents easily.
The FlowCursorList
provides these methods:
list[index]
- loads item fromCursor
at specified positionrefresh()
- re-queries the underlyingCursor
. Use aOnCursorRefreshListener
to get callbacks when this occurs.list.all
- converts it to aList
of all items from theCursor
, no caching used.list.count
- returns count ofCursor
or 0 ifCursor
isnull
list.isEmpty
- returns if count == 0
Flow Query List
This class is a much more powerful version of the FlowCursorList
. This class acts as List
and can be used almost wherever a List
is used.
Last updated