I am working in the field of context-aware adaptive GUIs, and in short im trying to adapt the GUI when a given condition is true. To adapt the GUI, I have each possible layouts as layout XMLs, and when it adapts, it loads the new layout, and merges the new viewgroup with the old by moving the new UI elements from the new view group to the old.
For some reason though, I am finding the android.os.MessageQueue instance gaining memory, and after each time the screen changes, the memory is not released. Since I am not reloading the Activity and only use application context, I don't understand why the memory is not being released when I change the GUI back to the first layout.
I had alook at other questions that involved the MessageQueue, and the Looper, but I don't understand why this object is getting larger. Could some one help me please?
UPDATE: I think I have solved my issue
I think my problem was I was taking each ViewGroup out of context without letting the messagequeue run. Therefore, even after the Views should be gone, the messages don't get processed. I found calling removeAllViews from the ViewGroup before taking it out of context solves the issue.