Open chendongde310 opened 8 years ago
I only found the removeNode, can not be dynamically refreshed?
Hi guy, I changed the name of the node, the value has changed, but it is not able to refresh the display out, how should I do?
Have you found any solution guys
Is Any one found the solution..
Sorry guys, I don't really have much time, will do my best to implement this at the weekend
How to refresh a node from outside the adapter. Just save a reference to your root node when creating the tree.
for (TreeNode n : root.getChildren())
{
YourAdapter adapter = (YourAdapter )n.getViewHolder();
adapter.value = anotherValue;
// Update a visible field
TextView tv = (TextView ) adapter.getView().findViewById(R.id.yourTextView);
tv.setText("new text");
}
Thanks For Reply, I created the same logic for my App as you suggested.
On Tue, Oct 18, 2016 at 1:13 PM, Havusport notifications@github.com wrote:
How to refresh a node from outside the adapter. Just save a reference to your root node when creating the tree.
for (TreeNode n : root.getChildren()) { YourAdapter adapter = (YourAdapter )n.getViewHolder(); adapter.value = anotherValue; // Update a visible field TextView tv = (TextView ) adapter.getView().findViewById(R.id. yourTextView); tv.setText("new text"); }
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bmelnychuk/AndroidTreeView/issues/91#issuecomment-254431401, or mute the thread https://github.com/notifications/unsubscribe-auth/ABwYgcky6EhCMXM1GMfA0UcrnI2Enh_tks5q1HiVgaJpZM4JhvbB .
Thanks & Regards Brajendra Pandey Mobile +91-9650307763 Skypee brajendra.pandey2
hey guys, I think i have a way to refresh the data of treeview: here is my code , if anyone need:
if (layout != null) {//layout is the view you inflated in method createView,keep a reference to class field
layout.removeAllViews();
TreeNode newroot = TreeNode.root();
fillTreeData(newroot, contextEvents);
AndroidTreeView newTree = new AndroidTreeView(getActivity(), newroot);
newTree.setDefaultAnimation(true);
newTree.setDefaultViewHolder(MyTreeViewHolder.class);
newTree.setDefaultContainerStyle(R.style.TreeNodeStyle);
layout.addView(newTree.getView());
}
these code can be called outside of method createView
in fragment.
@AlphaGao1993 , Thanks for the code. That really helped.
@AlphaGao1993 @Brajendra My use case is I am highlighting the selected node with different bg color for node. So when user rotates the device treeview loads from restoreState. and my selected node track gets lost. Any idea how this is achieved. What I have applied: I am storing the reference of selected node with the static field in Application class when user clicks on node. So when user rotates I am getting the nodes and holder(adapter) but changing the bgcolor not taking effects. Am I missing something
root.addChildren(s1) not working in api response
Hi guy, I want to refresh the data on the node, which method should be called?