I have created a view, basically it consists of a tableView with several tableViewRows, Inside of each row is a horizontal scrollView, and inside of the scroll view is a contentView that also contains a button and tttwo labels. Without posting a ton of code the basic outline follows.
EX:
TableView { TableViewRow 1: { ScrollView: { View 1: { ButtonView: {}, Label1: {}, Label2: {}, }, View 2: { ButtonView: {}, Label1: {}, Label2: {}, }, View 3: { ButtonView: {}, Label1: {}, Label2: {}, } } }, TableViewRow 2: { ScrollView: { View 1: { ButtonView: {}, Label1: {}, Label2: {}, }, View 2: { ButtonView: {}, Label1: {}, Label2: {}, }, } }, }In essence what this is creating is similar to the new layout of the iOS 6 App Store, where there is a vertical scrolling table with multiple groupings that scroll horizontally containing that groups related items. This works beautifully on iOS. Android on the other hand is a much different story, if built and run with the outline above the app crashes with a stackOverFlow error. Lets say I remove one of the labels from the Views it seems to run better, however scrolling through the scrollView will sometimes cause the app to crash with the same error, and sometimes it seems to tolerate it a bit longer. Also if android doesnt crash, switching to another window and back to the window in question, will often leave me with only part of the scroll view left, meaning if I had 6 views in the scroll view, I may only get 3 when returning to said window, the others are just gone.
I imagine this has something to do with the nesting of all the views??? I am not sure though? Has anyone had this issue and if so is there a better way to structure these nested views or a better way to handle what I am trying to accomplish?
ERROR:
08-17 23:15:05.744: E/TiApplication(8630): (main) [4663,9292] Sending event: exception on thread: main msg:java.lang.StackOverflowError; Titanium 2.1.1,2012/07/27 14:01,0fd84a2 08-17 23:15:05.744: E/TiApplication(8630): java.lang.StackOverflowError 08-17 23:15:05.744: E/TiApplication(8630): at android.widget.TextView.onDraw(TextView.java:4329) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.View.draw(View.java:6970) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:662) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:662) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:662) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.View.draw(View.java:7082) 08-17 23:15:05.744: E/TiApplication(8630): at android.widget.FrameLayout.draw(FrameLayout.java:357) 08-17 23:15:05.744: E/TiApplication(8630): at android.widget.HorizontalScrollView.draw(HorizontalScrollView.java:1417) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:662) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:662) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.View.draw(View.java:6973) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.View.buildDrawingCache(View.java:6695) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.View.getDrawingCache(View.java:6475) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1657) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at android.widget.AbsListView.dispatchDraw(AbsListView.java:1480) 08-17 23:15:05.744: E/TiApplication(8630): at android.widget.ListView.dispatchDraw(ListView.java:3193) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.View.draw(View.java:7082) 08-17 23:15:05.744: E/TiApplication(8630): at android.widget.AbsListView.draw(AbsListView.java:2588) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:662) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.View.draw(View.java:6973) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:662) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.View.draw(View.java:6973) 08-17 23:15:05.744: E/TiApplication(8630): at android.widget.FrameLayout.draw(FrameLayout.java:357) 08-17 23:15:05.744: E/TiApplication(8630): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1961) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.View.draw(View.java:6973) 08-17 23:15:05.744: E/TiApplication(8630): at android.widget.FrameLayout.draw(FrameLayout.java:357) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 08-17 23:15:05.744: E/TiApplication(8630): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 08-17 23:15:05.744: E/TiApplication(8630): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:662) 08-17 23:15:05.744: E/TiApplication(8630): at android.
2 Answers
For anyone trying to achieve the same type of layout I am, here is a solution. My problem on android was that I was trying to use a table view with table view rows for each of my sections. This is not a good Idea, I have always found that using tableViewRows on android is problematic, especially when you have a lot of rows or very complicated rows. Using the className does help in most situations but in this case it does not. Simple solution - don't use a table view and rows, instead try using a scrollView or view and a vertical layout. This now runs beautifully on both android and iOS
Hi
Frodeaux have you found already some solution for your problem? im asking because i have the same issue anand i have tried with tableViewRows and also with views and scroll views and the result is the same, crack!!!
Your Answer
Think you can help? Login to answer this question!