I have a TabView and on its first tab I have a ViewFlipper displaying two pages of ImageButtons (say buttonsPage1 and buttonsPage2).
When in landscape orientation, I need the image buttons pages to be scrollable, so I tried to add a ScrollView on buttonsPage1 and another on buttonsPage2. I get a StackOverflowError.
I tried then to suppress the ScrollView from the pageButtons1 and 2 and to include the ViewFlipper in a ScrollView. I got the same StackOverflowError.
If I completely remove the ViewFlipper, the applications runs as expected, no error occurs, only I DO need the scrolling when in landscape orientation.
Can anybody, please, give me hand to solve this issue?
If your stack trace lists a whole bunch of internal Android methods that seem to be related to drawing your UI, then your UI is too complicated. Use
hierarchyviewerand your emulator to view theView/ViewGrouptree for your activity, and find ways to remove layers. For example, if yourTabWidgetdoes not hold aViewFlipper, but rather you use anIntentto designate an activity that goes in the tab, that adds several layers to yourViewhierarchy more than just usingViewsas the contents of tabs.My general rule of thumb is to try to keep my view hierarchies to single digit depth, as measured from the root through the longest branch. By the time you get to 15 layers, you are almost assuredly going to crash somewhere.
If your
StackOverflowerror does not seem to be related to drawing your UI, though, you need to post the stack trace as an edit to this question.