bmelnychuk / AndroidTreeView

AndroidTreeView. TreeView implementation for android
Apache License 2.0
3k stars 620 forks source link

get name of parent node #161

Open george-chashel opened 6 years ago

george-chashel commented 6 years ago

how to get the name of the parent node after using view holders. eg

    TreeNode myDocuments = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "My Documents"));
    TreeNode downloads = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "Downloads"));
    TreeNode file1 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "Folder 1"));
    TreeNode file2 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "Folder 2"));
    TreeNode file3 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "Folder 3"));
    TreeNode file4 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "Folder 4"));
    fillDownloadsFolder(downloads);
    downloads.addChildren(file1, file2, file3, file4);

how to get the name of of "downloads" from file4

vinhgroup commented 6 years ago

MenuTreeItem parentNodeValues = (MenuTreeItem) node.getParent().getValue(); parentNodeValues.getMenuName();