bmelnychuk / AndroidTreeView

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

Restore state not working on large trees #154

Open Jamalek opened 6 years ago

Jamalek commented 6 years ago

I have a tree, about 3-4 layers deep, with about 200 items in total. When everything is collapsed I rotate the screen and try to restore tree state, everything is fine, but then, when I expand the root item to see 6 of its sub items and then rotate the display the restoration takes about 3 seconds. In Logcat I can see the following:

I/art: Background sticky concurrent mark sweep GC freed 47372(1853KB) AllocSpace objects, 29(1636KB) LOS objects, 7% free, 36MB/40MB, paused 1.402ms total 106.421ms I/art: Background partial concurrent mark sweep GC freed 155266(14MB) AllocSpace objects, 0(0B) LOS objects, 37% free, 26MB/42MB, paused 1.555ms total 150.112ms I/Choreographer: Skipped 213 frames! The application may be doing too much work on its main thread.

Trying this with more layers is ending up crashing the app.

juanmartinbernal commented 6 years ago

try to build the tree in another thread Asynctask to finish you pass the tree AndroidTreeView .... = new AndroidTreeView (context, root)