문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top