AndroidTreeView icon indicating copy to clipboard operation
AndroidTreeView copied to clipboard

Refresh Data

Open chendongde310 opened this issue 8 years ago • 11 comments

Hi guy, I want to refresh the data on the node, which method should be called?

chendongde310 avatar Aug 11 '16 02:08 chendongde310

I only found the removeNode, can not be dynamically refreshed?

oksimple avatar Aug 15 '16 03:08 oksimple

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?

Alexander-dfzz avatar Sep 14 '16 11:09 Alexander-dfzz

Have you found any solution guys

yoganlegendkiller avatar Sep 23 '16 05:09 yoganlegendkiller

Is Any one found the solution..

Brajendra avatar Oct 12 '16 06:10 Brajendra

Sorry guys, I don't really have much time, will do my best to implement this at the weekend

bmelnychuk avatar Oct 12 '16 07:10 bmelnychuk

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

Havusoft avatar Oct 18 '16 07:10 Havusoft

Thanks For Reply, I created the same logic for my App as you suggested.

On Tue, Oct 18, 2016 at 1:13 PM, Havusport [email protected] 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

Brajendra avatar Oct 18 '16 08:10 Brajendra

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.

gyqsophila avatar Mar 20 '17 02:03 gyqsophila

@AlphaGao1993 , Thanks for the code. That really helped.

partho-maple avatar Mar 24 '17 21:03 partho-maple

@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

raviyadav5951 avatar Aug 27 '19 09:08 raviyadav5951

root.addChildren(s1) not working in api response

Priya-Patil avatar Feb 02 '21 06:02 Priya-Patil