In Android SQLite, working directly with Cursor, is more memory more efficient than creating model objects?

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 ?

+4
source share
2 answers

The approach is Cursormore efficient in terms of memory:

, 1000 , ListView, 10 . , 1000 ( , , ), listview 10 ( , ) 10 . , , .

, CursorAdapter, , , , , . 1000.

, Cursors , ..

+6

, Service Thread/Async, . Service , . BroadcastReceiver Service.

0

All Articles