TreeView
TreeView copied to clipboard
How to refresh the treeNode view?
Sir, I added a downloaded icon to my list_item layout, and when I clicked on the icon to download successfully, I wanted to switch to another icon and update my item view. What can I do to implement this function? thank you.
now, I just do that:
// The corresponding treeNodeEntity is obtained from a custom interface in the Viewholder.
treeNodeEntity.setDownloaded(true); // set the status of node means downloaded.
// refresh this node
List<TreeNode> visibleNodes = treeViewAdapter.getTreeNodes();
for (int i = 0; i < visibleNodes.size(); i++) {
TreeNode node = visibleNodes.get(i);
TreeNodeEntity entity = (TreeNodeEntity) node.getValue();
if (treeNodeEntity.getId().equals(entity.getId())) {
treeViewAdapter.notifyItemChanged(i);
break;
}
}