Rakeeb Rajbhandari
Rakeeb Rajbhandari

Reputation: 5063

Managing listviews for large datas

I am about to start a project with a lot of static data which will be entered into a list view. All these data will be divided into 3-4 different categories but there will be an all-data category that will incorporate all these categories. I wanted to know how is the most efficient way to implement this ?

I could always make separate classes for the 3-4 categories I have and finally for the all-data category populate them all. But what would be the most efficient way to do this ? Help please

Upvotes: 0

Views: 58

Answers (1)

Ted Hopp
Ted Hopp

Reputation: 234857

There's nothing built in to Android to handle this directly. The easiest thing might be to define each category as a separate list of items. Create a ListAdapter for each list, then append them all together using a MergeAdapter (a very nice third-party adapter that allows you to concatenate views and other adapters as if they were a single stream of data to be provided to a ListView. You can use explicit views for the category names that are to appear in the ListView or you can wrap each ListAdapter in a HeaderViewListAdapter.

Upvotes: 1

Related Questions