footprint.
footprint.

Reputation: 11

How do we handle Cursors in Android?

Android Cursor Problem

I was reading this question and one of answer suggest that we should parse useful data regarding than parsing the whole Cursors.

Will this be applicable in the cursor if I were to parse a Cursors into a ListAdapter?

Upvotes: 0

Views: 587

Answers (2)

Otto
Otto

Reputation: 1685

I think what you said is correct.

Best choice: only query columns from DB that you actually need, i.e. using

db.query (String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy)

OK choice: do select * but only query the values you actually need from the cursor

Obviously, every operation takes some time, so if you're querying hundreds or thousands of DB records, it's better to do it efficiently!

Upvotes: 0

nicholas.hauschild
nicholas.hauschild

Reputation: 42834

I would not parse a Cursor into a ListAdapter. I would instead use a CursorAdapter for binding data to a ListView.

Upvotes: 1

Related Questions