简体   繁体   中英

Sort ListView ArrayAdapter that Contains Changing Data

I have a ListView, and and ArrayAdapter.

The items in the list contain views that change after the list is created.

Example:

List is created and displays a list of IP addresses.

A background thread pings the IP Addresses, then updates a view in the list to show if the host is reachable or not.

This works without issue.

What I want to do now is sort this list by weather or not the host is reachable.

I have the sorting method working, but changing the order of the list makes the whole list refresh. I don't want the list to refresh.

Any ideas?

listview.notifyDataSetChanged() will update the listview with changed data. In addition you can keep tracking of what item is being shown in the top and then you can make that item in the top within visible items.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM