Multiple ListAdapters or one using filtering (Android Performance)

Try to focus on common โ€œdos and dontsโ€ regarding lists, for example. is adding and removing 30 items from a list of 200 items better than cleaning and repopulating? Or any other tips in this area - I can't try on my phone to speed this up :-)

Is there a way to calculate the operational or computing power of the memory operations list. The background is as follows:

I have a list view on the page, the page has, for example. 3 Tabs below (All, Search, Recent). Now, if you click on the tab, the corresponding items should appear in the list view.

There are currently two different approaches: one of them:

Use one ListAdapter, filter items accordingly. - If you click "All", just put all the items from the database into it
- If you click "Recent", just put the items that meet the requirements

Use two (three) ListAdapters , one for each category
- If you click "All", set the "Adapter" () list to a suitable page - If you click "Recent", set "Adapter" () to the appropriate

200 , , . , , , , . , (. datastructure).

, , " ", (, LIKE abc), EITHER:

  • ( )
  • ,

, :

  • ( + +...)
  • HashSet , , readonly +
  • ArrayList , View

, , , "" . , , , , :

  • N ( ) "title LIKE"
  • 200 "title.contains()"
  • 100 SHOWN
  • 100 arraylist,

. , , , " ", ListAdapter

+5
3

, , , , ArrayList , .

, HashSet .

, ListAdapter, ArrayAdapter

  • ArrayList mAllObjects ( "" ).
  • ArrayList mRecentObject ( "" )
  • ArrayList mMatchObject ( "" )
    • mRecentObject ( , )
    • mMatchObject . . delete() ArrayList O (n).
+1

, , , filtering ( )... ( ), , .

+1

. ( ) " " , , , . : 1) ( ) 2) GC, .

, , deltas. , :

  • ( )

, , . , . GC , .

+1

All Articles