Question

I have a list populated by a list adapter with data from the server. Regardless of the data returned (or lack thereof) I want the first item of the list to always be the same (an item I created).

How do I call the setData method so that the first item is always there?

Was it helpful?

Solution

You could copy the dynamic data to a local List and insert the static item at the beginning of the List each time, and then use that List, containing both static and dynamic data, with an ArrayAdapter.

Hope this helped.

OTHER TIPS

You should use this method:

ListView lv = (initialize your list view here)

lv.addHeaderView(View v); v is a parameter, inflate the item you always want there and put it in this way. It will always show up at the top of the list.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top