In most Android code examples, populating the ListView database from SQLite is done in two ways:
Pre-fetching data into a list - Executing a query, creating model objects for each row, then adding to the List and closing the Cursor , then enter the ListView into the List .
Without List and Model objects - Run a query and populate a ListView , following the Cursor , using moveToFirst . >, moveToLast , move if necessary.
Now I want to know which of the above methods is more memory efficient in Android ?
The approach is Cursormore efficient in terms of memory:
Cursor
, 1000 , ListView, 10 . , 1000 ( , , ), listview 10 ( , ) 10 . , , .
, CursorAdapter, , , , , . 1000.
CursorAdapter
, Cursors , ..
, Service Thread/Async, . Service , . BroadcastReceiver Service.
Service
Thread/Async
BroadcastReceiver