Search code examples
androidlistviewandroid-listviewlistadapter

Android ListView, static item


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?


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.