4

I was wondering if there is any optimized way to create an adapter that holds more than 1k object in it. I have tried the following but still the results were not promising .

A.View holder pattern-It helped but when the object size increased it started have issues

B.Note: I could have used a paginated api which passes a defined number of objects but I annot have paginated Api in my scenerio.

C.My list do have images in it but I have taken care of that.Its not a problem now.

Let me know of any new ways to achieve a adapter that can have a large number of object list in it without any issues.

Abx
  • 2,852
  • 4
  • 30
  • 50
  • what are those objects? How do you get them? And what is slow? Is it the scrolling of your list view or the initialization? – Jörn Buitink Nov 18 '15 at 08:00
  • your implementation would help, too. Especially how you load your data und how you implemented the getView function. – Jörn Buitink Nov 18 '15 at 08:01
  • @JörnBuitink.The objects in my case are details of an institution which is provided by an api which in a worst case scenario may return more than 1k results..I was able to load the entire list but still had some scroll issues and even in some device the position gets altered.. – Abx Nov 18 '15 at 08:43
  • One of my workaround was to store the object list(by this I mean the array of objects) localy and make to produce data on demand.Its kind of a local pagination for objects. – Abx Nov 18 '15 at 08:46

1 Answers1

3

As far as I know, I use some structure below

  • Use ViewHolder
  • Do not create new object if you not use
  • Optimizing Layout Hierarchies

https://developer.android.com/training/improving-layouts/optimizing-layout.html

  • Prevent Overdraw

https://developer.android.com/tools/performance/debug-gpu-overdraw/index.html

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Linh
  • 57,942
  • 23
  • 262
  • 279