java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0

Appcelerator JIRA | Lokesh Choudhary | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    h5. This is a regression. It works as expected with 3.2.2.GA h5.Description: 1. Create an classic app & use the code below in the app.js. {code} var win = Ti.UI.createWindow({ backgroundColor: 'white', title: "ScrollableView Test" }); var sav = Ti.UI.createScrollableView(); win.add(sav); win.open(); {code} 3. Build that app for device/emulator. h5.Actual Result: 1. The app crashes & we get the following logs in console: {code} [ERROR] : TiApplication: (main) [335,335] Sending event: exception on thread: main msg:java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0; Titanium 3.2.3,2014/04/22 10:17,b958a70 [ERROR] : TiApplication: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 [ERROR] : TiApplication: at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) [ERROR] : TiApplication: at java.util.ArrayList.get(ArrayList.java:304) [ERROR] : TiApplication: at ti.modules.titanium.ui.widget.TiUIScrollableView$2.onPageScrolled(TiUIScrollableView.java:192) [ERROR] : TiApplication: at android.support.v4.view.ViewPager.onPageScrolled(ViewPager.java:1712) [ERROR] : TiApplication: at android.support.v4.view.ViewPager.pageScrolled(ViewPager.java:1633) [ERROR] : TiApplication: at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:581) [ERROR] : TiApplication: at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1600) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at android.widget.FrameLayout.onLayout(FrameLayout.java:448) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1669) [ERROR] : TiApplication: at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1527) [ERROR] : TiApplication: at android.widget.LinearLayout.onLayout(LinearLayout.java:1440) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at android.widget.FrameLayout.onLayout(FrameLayout.java:448) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2147) [ERROR] : TiApplication: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1966) [ERROR] : TiApplication: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1179) [ERROR] : TiApplication: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4859) [ERROR] : TiApplication: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749) [ERROR] : TiApplication: at android.view.Choreographer.doCallbacks(Choreographer.java:562) [ERROR] : TiApplication: at android.view.Choreographer.doFrame(Choreographer.java:532) [ERROR] : TiApplication: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735) [ERROR] : TiApplication: at android.os.Handler.handleCallback(Handler.java:725) [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:5328) [ERROR] : TiApplication: at java.lang.reflect.Method.invokeNative(Native Method) [ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:511) [ERROR] : TiApplication: at [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) [ERROR] : TiApplication: at dalvik.system.NativeStart.main(Native Method) {code} h5. Expected Results: 1. The app should not crash when an empty scrollable view is added.

    Appcelerator JIRA | 3 years ago | Lokesh Choudhary
    java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
  2. 0

    h5. This is a regression. It works as expected with 3.2.2.GA h5.Description: 1. Create an classic app & use the code below in the app.js. {code} var win = Ti.UI.createWindow({ backgroundColor: 'white', title: "ScrollableView Test" }); var sav = Ti.UI.createScrollableView(); win.add(sav); win.open(); {code} 3. Build that app for device/emulator. h5.Actual Result: 1. The app crashes & we get the following logs in console: {code} [ERROR] : TiApplication: (main) [335,335] Sending event: exception on thread: main msg:java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0; Titanium 3.2.3,2014/04/22 10:17,b958a70 [ERROR] : TiApplication: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 [ERROR] : TiApplication: at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) [ERROR] : TiApplication: at java.util.ArrayList.get(ArrayList.java:304) [ERROR] : TiApplication: at ti.modules.titanium.ui.widget.TiUIScrollableView$2.onPageScrolled(TiUIScrollableView.java:192) [ERROR] : TiApplication: at android.support.v4.view.ViewPager.onPageScrolled(ViewPager.java:1712) [ERROR] : TiApplication: at android.support.v4.view.ViewPager.pageScrolled(ViewPager.java:1633) [ERROR] : TiApplication: at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:581) [ERROR] : TiApplication: at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1600) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at android.widget.FrameLayout.onLayout(FrameLayout.java:448) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1669) [ERROR] : TiApplication: at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1527) [ERROR] : TiApplication: at android.widget.LinearLayout.onLayout(LinearLayout.java:1440) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at android.widget.FrameLayout.onLayout(FrameLayout.java:448) [ERROR] : TiApplication: at android.view.View.layout(View.java:14482) [ERROR] : TiApplication: at android.view.ViewGroup.layout(ViewGroup.java:4469) [ERROR] : TiApplication: at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2147) [ERROR] : TiApplication: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1966) [ERROR] : TiApplication: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1179) [ERROR] : TiApplication: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4859) [ERROR] : TiApplication: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749) [ERROR] : TiApplication: at android.view.Choreographer.doCallbacks(Choreographer.java:562) [ERROR] : TiApplication: at android.view.Choreographer.doFrame(Choreographer.java:532) [ERROR] : TiApplication: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735) [ERROR] : TiApplication: at android.os.Handler.handleCallback(Handler.java:725) [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:5328) [ERROR] : TiApplication: at java.lang.reflect.Method.invokeNative(Native Method) [ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:511) [ERROR] : TiApplication: at [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) [ERROR] : TiApplication: at dalvik.system.NativeStart.main(Native Method) {code} h5. Expected Results: 1. The app should not crash when an empty scrollable view is added.

    Appcelerator JIRA | 3 years ago | Lokesh Choudhary
    java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
  3. 0

    Titanium Android Issue With Scrollable View App Crashes

    Stack Overflow | 3 years ago | saif
    java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IndexOutOfBoundsException

    Invalid index 0, size is 0

    at java.util.ArrayList.throwIndexOutOfBoundsException()
  2. Java RT
    ArrayList.get
    1. java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
    2. java.util.ArrayList.get(ArrayList.java:304)
    2 frames
  3. ti.modules.titanium
    TiUIScrollableView$2.onPageScrolled
    1. ti.modules.titanium.ui.widget.TiUIScrollableView$2.onPageScrolled(TiUIScrollableView.java:192)
    1 frame
  4. Android Support v4
    ViewPager.onLayout
    1. android.support.v4.view.ViewPager.onPageScrolled(ViewPager.java:1712)
    2. android.support.v4.view.ViewPager.pageScrolled(ViewPager.java:1633)
    3. android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:581)
    4. android.support.v4.view.ViewPager.onLayout(ViewPager.java:1600)
    4 frames
  5. Android Platform
    ViewGroup.layout
    1. android.view.View.layout(View.java:14482)
    2. android.view.ViewGroup.layout(ViewGroup.java:4469)
    2 frames
  6. org.appcelerator.titanium
    TiCompositeLayout.onLayout
    1. org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578)
    1 frame
  7. Android Platform
    ViewGroup.layout
    1. android.view.View.layout(View.java:14482)
    2. android.view.ViewGroup.layout(ViewGroup.java:4469)
    2 frames
  8. org.appcelerator.titanium
    TiCompositeLayout.onLayout
    1. org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578)
    1 frame
  9. Android Platform
    ViewGroup.layout
    1. android.view.View.layout(View.java:14482)
    2. android.view.ViewGroup.layout(ViewGroup.java:4469)
    2 frames
  10. org.appcelerator.titanium
    TiCompositeLayout.onLayout
    1. org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578)
    1 frame
  11. Android Platform
    ActivityThread.main
    1. android.view.View.layout(View.java:14482)
    2. android.view.ViewGroup.layout(ViewGroup.java:4469)
    3. android.widget.FrameLayout.onLayout(FrameLayout.java:448)
    4. android.view.View.layout(View.java:14482)
    5. android.view.ViewGroup.layout(ViewGroup.java:4469)
    6. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1669)
    7. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1527)
    8. android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
    9. android.view.View.layout(View.java:14482)
    10. android.view.ViewGroup.layout(ViewGroup.java:4469)
    11. android.widget.FrameLayout.onLayout(FrameLayout.java:448)
    12. android.view.View.layout(View.java:14482)
    13. android.view.ViewGroup.layout(ViewGroup.java:4469)
    14. android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2147)
    15. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1966)
    16. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1179)
    17. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4859)
    18. android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
    19. android.view.Choreographer.doCallbacks(Choreographer.java:562)
    20. android.view.Choreographer.doFrame(Choreographer.java:532)
    21. android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
    22. android.os.Handler.handleCallback(Handler.java:725)
    23. android.os.Handler.dispatchMessage(Handler.java:92)
    24. android.os.Looper.loop(Looper.java:137)
    25. android.app.ActivityThread.main(ActivityThread.java:5328)
    25 frames
  12. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:511)
    2 frames