Does the Content Resolver query retrieves all the data at once? if so, how to optimize this to retrieve the data as the cursor moves? (is it possible at all? if not, how to optimize this process?)
Asked
Active
Viewed 124 times
2 Answers
1
Content resolvers are designed to allow accessing data in other apps, so to reduce communication overhead, they try to retrieve as much data as possible (using a CursorWindow).
However, calling query()
and then iterating over the cursor with moveToNext()
is the only way to retrieve data, so there is nothing you can do to optimize it.
When you are not reading but modifying data, and have multiple rows, you should use functions such as bulkInsert() or applyBatch().

CL.
- 173,858
- 17
- 217
- 259
-
`Being the only way to retrieve data` does not mean `there is nothing you can do to optimize it.` Right? – amrezzd Aug 12 '18 at 11:54
-
What are you going to do? There is no call to retrieve multiple rows at once. – CL. Aug 12 '18 at 12:52
0
To few information, write more precicely what do you want to get in your app? ContentResolver
only handle a query that you declare in ContentProvider
. What data query command will return, depends on you.

Stanislav Batura
- 420
- 4
- 11
-
This is not an answer either. better ask such questions in the comment – amrezzd Aug 12 '18 at 06:42