[TIMOB-711] Android TableViewRow's with same className and different layout crash
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2012-07-25T14:14:06.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | android, defect |
Reporter | Dan Mullineux |
Assignee | Neeraj Gupta |
Created | 2011-04-15T02:34:57.000+0000 |
Updated | 2012-10-25T10:12:07.000+0000 |
Description
My second defect relating to TableViewRows.
if you create a few TableViewRows containing a few different layouts but give them the same className.
When you change orientation Android crashes. Documentation should probably be more explicit about the importance of clasName, and at least trap and report the error (later inteligent hash for className?)
Salient exception below from the Orientation changed event...
W/InputManagerService( 75): Window already focused, ignoring
focus gain of:
com.android.internal.view.IInputMethodClient$Stub$Proxy@4339b338
I/WindowManager( 75): onOrientationChanged, rotation changed to
1
I/WindowManager( 75): Setting rotation to 1, animFlags=0
I/WindowManager( 75): Config changed: { scale=1.0 imsi=0/0
loc=en_GB touch=3 keys=2/1/2 nav=3 orien=2 layout=18}
D/LAYOUT ( 2636): (main) [3738,15715] TabHost {0,0,480,295}
D/LAYOUT ( 2636): (main) [5,15720] TiTableView {0,0,480,227}
D/TiFileFactory( 2636): (main) [16,15736] getting initial from
parts: app://images/smile_logo.png
D/TiFileFactory( 2636): (main) [5,15741] getting initial from
parts: file:///android_asset/Resources/images/smile_logo.png
D/TiBackground( 2636): (main) [5,15746]
background=BitmapDrawable,state.len=2,state[0]=16842909
D/AndroidRuntime( 2636): Shutting down VM
W/dalvikvm( 2636): threadid=3: thread exiting with uncaught
exception (group=0x4001da28)
D/StatusBar( 75): updateResources
E/TiUncaughtHandler( 2636): (main) [7,15753] Sending event:
exception on thread: main
msg:java.lang.ArrayIndexOutOfBoundsException
E/TiUncaughtHandler( 2636):
java.lang.ArrayIndexOutOfBoundsException
E/TiUncaughtHandler( 2636): at
ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(Unknown
Source)
E/TiUncaughtHandler( 2636): at
ti.modules.titanium.ui.widget.tableview.TiTableView$TTVListAdapter.getView(Unknown
Source)
E/TiUncaughtHandler( 2636): at
android.widget.AbsListView.obtainView(AbsListView.java:1255)
E/TiUncaughtHandler( 2636): at
android.widget.ListView.makeAndAddView(ListView.java:1658)
E/TiUncaughtHandler( 2636): at
android.widget.ListView.fillSpecific(ListView.java:1212)
E/TiUncaughtHandler( 2636): at
android.widget.ListView.layoutChildren(ListView.java:1494)
E/TiUncaughtHandler( 2636): at
android.widget.AbsListView.onLayout(AbsListView.java:1112)
E/TiUncaughtHandler( 2636): at
android.view.View.layout(View.java:6569)
E/TiUncaughtHandler( 2636): at
android.widget.FrameLayout.onLayout(FrameLayout.java:333)
E/TiUncaughtHandler( 2636): at
android.view.View.layout(View.java:6569)
E/TiUncaughtHandler( 2636): at
org.appcelerator.titanium.view.TiCompositeLayout.onLayout(Unknown
Source)
E/TiUncaughtHandler( 2636): at
android.view.View.layout(View.java:6569)
E/TiUncaughtHandler( 2636): at
android.widget.FrameLayout.onLayout(FrameLayout.java:333)
E/TiUncaughtHandler( 2636): at
android.view.View.layout(View.java:6569)
E/TiUncaughtHandler( 2636): at
android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
E/TiUncaughtHandler( 2636): at
android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
E/TiUncaughtHandler( 2636): at
android.widget.LinearLayout.onLayout(LinearLayout.java:918)
E/TiUncaughtHandler( 2636): at
android.view.View.layout(View.java:6569)
E/TiUncaughtHandler( 2636): at
android.widget.FrameLayout.onLayout(FrameLayout.java:333)
E/TiUncaughtHandler( 2636): at
android.view.View.layout(View.java:6569)
E/TiUncaughtHandler( 2636): at
android.widget.FrameLayout.onLayout(FrameLayout.java:333)
E/TiUncaughtHandler( 2636): at
android.view.View.layout(View.java:6569)
E/TiUncaughtHandler( 2636): at
android.widget.FrameLayout.onLayout(FrameLayout.java:333)
E/TiUncaughtHandler( 2636): at
android.view.View.layout(View.java:6569)
E/TiUncaughtHandler( 2636): at
org.appcelerator.titanium.view.TiCompositeLayout.onLayout(Unknown
Source)
E/TiUncaughtHandler( 2636): at
android.view.View.layout(View.java:6569)
E/TiUncaughtHandler( 2636): at
android.widget.FrameLayout.onLayout(FrameLayout.java:333)
E/TiUncaughtHandler( 2636): at
android.view.View.layout(View.java:6569)
E/TiUncaughtHandler( 2636): at
android.widget.FrameLayout.onLayout(FrameLayout.java:333)
E/TiUncaughtHandler( 2636): at
android.view.View.layout(View.java:6569)
E/TiUncaughtHandler( 2636): at
android.view.ViewRoot.performTraversals(ViewRoot.java:979)
E/TiUncaughtHandler( 2636): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1613)
E/TiUncaughtHandler( 2636): at
android.os.Handler.dispatchMessage(Handler.java:99)
E/TiUncaughtHandler( 2636): at
android.os.Looper.loop(Looper.java:123)
E/TiUncaughtHandler( 2636): at
android.app.ActivityThread.main(ActivityThread.java:4203)
E/TiUncaughtHandler( 2636): at
java.lang.reflect.Method.invokeNative(Native Method)
E/TiUncaughtHandler( 2636): at
java.lang.reflect.Method.invoke(Method.java:521)
E/TiUncaughtHandler( 2636): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/TiUncaughtHandler( 2636): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
E/TiUncaughtHandler( 2636): at
dalvik.system.NativeStart.main(Native Method)
D/dalvikvm( 2636): GC freed 8533 objects / 529456 bytes in
174ms
D/TiApplication( 2636): (main) [1102,16855] Analytics Event:
type=ti.crash
D/TiApplication( 2636): event=ti.crash
D/TiApplication( 2636): timestamp=2010-04-03T02:50:32.179+0000
D/TiApplication( 2636): mid=200145da90baeb2c
D/TiApplication( 2636):
sid=846bba95-0f52-4b77-b31c-9c1645e4f576
D/TiApplication( 2636):
aguid=f47edb0e-2f5a-4399-bd28-d6fa66bb8e60
D/TiApplication( 2636): isJSON=true
The rows do not have to have a different layout to be affected. I have many tables that blow up seemingly at random unless the class name is unique for every row (even if the the layout is the same and just the text of a label is different). The fix for now is to make classname unique for every row of every table.
1) Rows sometimes change positions or disappear while scrolling.
2) The application will crash at random
I've fixed most of the issues surround weird re-drawing. The root of the problem was we were always reusing views when no className was provided (since all rows had the same default class name). See this issue:
https://appcelerator.lighthouseapp.com/projects/32238/tickets/1193-corrupted-table-rows-with-different-layouts-and-no-class-names"> https://appcelerator.lighthouseapp.com/projects/32238/tickets/1193-...
Would you guys mind updating to the latest? I haven't been able to reproduce the "same class different layout" crash with the current code
Cannot reproduce.
it's not fixed. In 2.1.1, it's still there, when i use the same className for rows with different layout, the app will crash.
my log is like this: 10-21 16:15:47.730: E/TiApplication(27248): (main) [3061,8154] Sending event: exception on thread: main msg:java.lang.ArrayIndexOutOfBoundsException: length=1; index=1; Titanium 2.1.1,2012/07/27 14:01,0fd84a2 10-21 16:15:47.730: E/TiApplication(27248): java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 10-21 16:15:47.730: E/TiApplication(27248): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.applyChildProxies(TiTableViewRowProxyItem.java:164) 10-21 16:15:47.730: E/TiApplication(27248): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.applyChildProxies(TiTableViewRowProxyItem.java:167) 10-21 16:15:47.730: E/TiApplication(27248): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.applyChildProxies(TiTableViewRowProxyItem.java:167) 10-21 16:15:47.730: E/TiApplication(27248): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.applyChildProxies(TiTableViewRowProxyItem.java:167) 10-21 16:15:47.730: E/TiApplication(27248): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.refreshControls(TiTableViewRowProxyItem.java:144) 10-21 16:15:47.730: E/TiApplication(27248): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:280) 10-21 16:15:47.730: E/TiApplication(27248): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:83) 10-21 16:15:47.730: E/TiApplication(27248): at ti.modules.titanium.ui.widget.tableview.TiTableView$TTVListAdapter.getView(TiTableView.java:216) 10-21 16:15:47.730: E/TiApplication(27248): at android.widget.AbsListView.obtainView(AbsListView.java:2195) 10-21 16:15:47.730: E/TiApplication(27248): at android.widget.ListView.makeAndAddView(ListView.java:1774) 10-21 16:15:47.730: E/TiApplication(27248): at android.widget.ListView.fillDown(ListView.java:672) 10-21 16:15:47.730: E/TiApplication(27248): at android.widget.ListView.fillGap(ListView.java:636) 10-21 16:15:47.730: E/TiApplication(27248): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5257) 10-21 16:15:47.730: E/TiApplication(27248): at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:3057) 10-21 16:15:47.730: E/TiApplication(27248): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3398) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.View.dispatchTouchEvent(View.java:5681) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1951) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1712) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726) 10-21 16:15:47.730: E/TiApplication(27248): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2063) 10-21 16:15:47.730: E/TiApplication(27248): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1399) 10-21 16:15:47.730: E/TiApplication(27248): at android.app.Activity.dispatchTouchEvent(Activity.java:2364) 10-21 16:15:47.730: E/TiApplication(27248): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2011) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.View.dispatchPointerEvent(View.java:5861) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3094) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2614) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:978) 10-21 16:15:47.730: E/TiApplication(27248): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2623) 10-21 16:15:47.730: E/TiApplication(27248): at android.os.Handler.dispatchMessage(Handler.java:99) 10-21 16:15:47.730: E/TiApplication(27248): at android.os.Looper.loop(Looper.java:137) 10-21 16:15:47.730: E/TiApplication(27248): at android.app.ActivityThread.main(ActivityThread.java:4507) 10-21 16:15:47.730: E/TiApplication(27248): at java.lang.reflect.Method.invokeNative(Native Method) 10-21 16:15:47.730: E/TiApplication(27248): at java.lang.reflect.Method.i
I've been able to reproduce this with something as simple as using a different font on a row with the same className. The (complex) row's were constructed the same, but some had italic font while others had regular on one of the labels.