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
in开发者_运维问答to a ListAdapter
?
I would not parse a Cursor
into a ListAdapter
. I would instead use a CursorAdapter
for binding data to a ListView
.
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!
精彩评论