TreeView icon indicating copy to clipboard operation
TreeView copied to clipboard

How to refresh the treeNode view?

Open YuQi9797 opened this issue 6 months ago • 1 comments

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.

YuQi9797 avatar Jul 21 '25 05:07 YuQi9797

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;
        }
}

YuQi9797 avatar Jul 21 '25 05:07 YuQi9797