Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-20038

Android: TableView crashes when scrolling more than 29 rows

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: titanium 5.0.5
    • Fix Version/s: Release 5.2.0
    • Component/s: Android
    • Labels:
    • Environment:

      Windows 7 (64Bit)
      Appcelerator Studio Build: 4.3.2.201510020431
      Ti SDK: 3.5.1.GA & 3.5.2.v20150619094811
      CLI: 5.0.2
      Device: Samsung Galaxy Note 10.1 JellyBean 4.1.2 (API16)

    • Story Points:
      8
    • Sprint:
      2015 Sprint 25 SDK

      Description

      When executing the following code, if there are more than 29 rows, the app will crash when scrolling back up from the bottom of the TableView:

      (You may need to try more than 30 rows for the app to crash, as each device may vary this number)

      var section = Ti.UI.createTableViewSection();
      var numberOfRows = 30;	//if > 29 the app will crash when scrolling back up from the bottom
       
      for (var i=0; i < numberOfRows; i++)	 
      {	
      	//fill section with rows	
      	section.add(Ti.UI.createTableViewRow({
      		height: 50,
      		width: Ti.UI.FILL,
      		backgroundColor: 'green',
      		className: 'row' + i
      	}));
      };
       
      var table = Ti.UI.createTableView({
      	top: 0,
      	left: 0,
      	height: Ti.UI.FILL,
      	width: Ti.UI.FILL,
      	data: [ section ]
      });
       
      var window = Ti.UI.createWindow({
      	fullscreen: true		
      });
       
      window.add(table);
      window.open();

      The error log from the Studio console is:

      [ERROR] :  InputEventReceiver: Exception dispatching input event.
      [DEBUG] :  AndroidRuntime: Shutting down VM
      [WARN] :   dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x410532a0)
      [ERROR] :  TiApplication: (main) [25408,25408] Sending event: exception on thread: main msg:java.lang.ArrayIndexOutOfBoundsException: length=32; index=32; Titanium 3.5.1,2015/03/05 10:08,96875c9
      [ERROR] :  TiApplication: java.lang.ArrayIndexOutOfBoundsException: length=32; index=32
      [ERROR] :  TiApplication: 	at android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:7127)
      [ERROR] :  TiApplication: 	at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5694)
      [ERROR] :  TiApplication: 	at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:3424)
      [ERROR] :  TiApplication: 	at android.widget.AbsListView.onTouchEvent(AbsListView.java:4099)
      [ERROR] :  TiApplication: 	at android.view.View.dispatchTouchEvent(View.java:7350)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2464)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2470)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2212)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2470)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2212)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2470)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2212)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2470)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2212)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2470)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2212)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2470)
      [ERROR] :  TiApplication: 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2212)
      [ERROR] :  TiApplication: 	at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2151)
      [ERROR] :  TiApplication: 	at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1480)
      [ERROR] :  TiApplication: 	at android.app.Activity.dispatchTouchEvent(Activity.java:2469)
      [ERROR] :  TiApplication: 	at android.support.v7.app.ActionBarActivityDelegateICS$WindowCallbackWrapper.dispatchTouchEvent(ActionBarActivityDelegateICS.java:268)
      [ERROR] :  TiApplication: 	at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2099)
      [ERROR] :  TiApplication: 	at android.view.View.dispatchPointerEvent(View.java:7535)
      [ERROR] :  TiApplication: 	at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3492)
      [ERROR] :  TiApplication: 	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3424)
      [ERROR] :  TiApplication: 	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4534)
      [ERROR] :  TiApplication: 	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4512)
      [ERROR] :  TiApplication: 	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4616)
      [ERROR] :  TiApplication: 	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
      [ERROR] :  TiApplication: 	at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
      [ERROR] :  TiApplication: 	at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163)
      [ERROR] :  TiApplication: 	at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4584)
      [ERROR] :  TiApplication: 	at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4635)
      [ERROR] :  TiApplication: 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
      [ERROR] :  TiApplication: 	at android.view.Choreographer.doCallbacks(Choreographer.java:555)
      [ERROR] :  TiApplication:
      [ERROR] :  TiApplication: 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
      [ERROR] :  TiApplication: 	at android.os.Handler.handleCallback(Handler.java:615)
      [ERROR] :  TiApplication: 	at android.os.Handler.dispatchMessage(Handler.java:92)
      [ERROR] :  TiApplication: 	at android.os.Looper.loop(Looper.java:137)
      [ERROR] :  TiApplication: 	at android.app.ActivityThread.main(ActivityThread.java:4921)
      [ERROR] :  TiApplication: 	at java.lang.reflect.Method.invokeNative(Native Method)
      [ERROR] :  TiApplication: 	at java.lang.reflect.Method.invoke(Method.java:511)
      [ERROR] :  TiApplication: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
      [ERROR] :  TiApplication: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
      [ERROR] :  TiApplication: 	at dalvik.system.NativeStart.main(Native Method)

      I have tried removing the "className" property from the TableViewRow, which stops the crashing, but prevents Buttons and other Views inside the TableViewRow redrawing correctly, so must be left in (as indicated by the Appcelerator Platform Docs).

      Due to our customers using JellyBean devices, we need the fix in 3.5.1 or 3.5.2, as the devices can't be upgraded to newer Android versions.

      Possible Cause:

      This may be caused by an issue with 0-Based indexes used in getItemViewType() or getViewTypeCount() in titanium_mobile/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiListView.java

        Attachments

          Activity

            People

            • Assignee:
              hpham Hieu Pham
              Reporter:
              anfen Adam Fennell
              Reviewer:
              Ashraf Abu (Inactive)
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-20713
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code