Reputation: 41
I have to implement design in this Mockup, my List will fetch real time data from server and cache it.
The list will contain large images and up to 1000s of items.
While scrolling up and/or down, the list should load data cached(stored) locally or download from server.
Since such huge list will require a lot of memory and processing (which is not available on mobile devices), I need to apply very well optimized design pattern.
Questions
Can anyone please suggest any Design pattern for this?
How would you implement this?
Relevant question: List View Design Pattern
Upvotes: 4
Views: 1008
Reputation: 1916
In you case as you have lots of data specially images you should use Loader Class concept as explained by rominGuy in Google IO-2010 Here you reuse each row when it goes out of view and another row comes in visibility.
Upvotes: 0
Reputation: 1372
Commonsguy (Mark Murphy) implemented a very nice endless listview here :
https://github.com/commonsguy/cwac-endless
It avoids loading a large data set for your listview and allow user to scroll more and more elements as the scrolling goes. I tested it, it's pretty neat: number of elements added when you reach the bottom, async loading, etc. You'll have to work on the scroll back part because as it is, the scrolling is dynamically incremented when you scroll down (not up).
Upvotes: 1
Reputation: 2654
You could store the image and the data in a database that you can use a cache and populate the database using a background process like a service.
Upvotes: 0