Titanium JIRA Archive
Appcelerator Community (AC)

[AC-918] IndexOutOfBoundsException in TiApplication.getCurrentActivity

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNeeds more info
Resolution Date2015-09-29T01:03:53.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid
Reportergrebulon
AssigneeShak Hossain
Created2014-11-23T09:13:26.000+0000
Updated2016-03-08T07:37:13.000+0000

Description

I have no idea how this happened. Got this in the Developer Console's Crashes and ANRs from one of our testers. The only way this can happen is if reference was removed in a different thread while in the getCurrent loop. {quote} java.lang.RuntimeException: Unable to pause activity \{com.pingapp.app/org.appcelerator.titanium.TiActivity\}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3196) at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3151) at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3129) at android.app.ActivityThread.access$900(ActivityThread.java:159) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1333) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5419) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.remove(ArrayList.java:403) at org.appcelerator.titanium.TiApplication.getCurrentActivity(TiApplication.java:297) at org.appcelerator.titanium.TiApplication.setCurrentActivity(TiApplication.java:569) at org.appcelerator.titanium.TiBaseActivity.onPause(TiBaseActivity.java:1060) at org.appcelerator.titanium.TiActivity.onPause(TiActivity.java:48) at android.app.Activity.performPause(Activity.java:5474) at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1250) at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3182) ... 12 more {quote}

Comments

  1. Shuo Liang 2014-11-24

    Please provide a test case to reproduce your problem.
  2. grebulon 2014-11-24

    As I wrote, I got this on the google developer console from one of the testers. I have no idea how this happened or how to reproduce it, but it definitely happened.
  3. grebulon 2015-09-29

    Why is this marked as resolved? It is NOT resolved. This is a real case of a real use. Better mark it as "we don't care"

JSON Source