I'm developing a Treeview layout in Android and I have a problem with the refresh. This is what I see
Now I receive a message to add a resource to this treeview. What I'd like is to have the device to be added while I'm watching the treeview, without it scrolling to the beginning, be recreated or stuff like that. Only the minimum scroll to make room to the new component.
My treeview is built in this way:
Every element is a LinearLayout with some properties, visible (like the name) and invisible (like the ip, the father and so on)
I find the father of all the devices (rootFather)
Recursively I examine every device and add it to the proper father (which is a LinearLayout)
I embed the rootFather in a ScrollView
I embed the ScrollView in a LinearLayout
I display the layout
Now when a new device "arrives", I parse it and build it then I add it to the proper father and this whole process happens in the Activity that shows the Treeview.
The problem is that nothing happens, no refresh, anything. If I press the back button and reopen the Activity with the Treeview the object is correctly displayed.
What is the correct approach to solve this problem? Should I change approach? Should I call some magic method after the child has been added?
Thanks