java.lang.RuntimeException: Unable to resume activity {com.yoreach.residentapp/com.lzy.imagepicker.ui.ImageGridActivity}: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3493)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3533)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6342)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.get(ArrayList.java:411)
at com.lzy.imagepicker.ImageDataSource.onLoadFinished(ImageDataSource.java:130)
at com.lzy.imagepicker.ImageDataSource.onLoadFinished(ImageDataSource.java:27)
at android.support.v4.app.LoaderManagerImpl$LoaderObserver.onChanged(LoaderManagerImpl.java:221)
at android.arch.lifecycle.LiveData.considerNotify(LiveData.java:109)
at android.arch.lifecycle.LiveData.dispatchingValue(LiveData.java:126)
at android.arch.lifecycle.LiveData.setValue(LiveData.java:282)
at android.arch.lifecycle.MutableLiveData.setValue(MutableLiveData.java:33)
at android.support.v4.app.LoaderManagerImpl$LoaderInfo.onLoadComplete(LoaderManagerImpl.java:156)
at android.support.v4.content.Loader.deliverResult(Loader.java:130)
at android.support.v4.content.CursorLoader.deliverResult(CursorLoader.java:107)
at android.support.v4.content.CursorLoader.onStartLoading(CursorLoader.java:153)
at android.support.v4.content.Loader.startLoading(Loader.java:283)
at android.support.v4.app.LoaderManagerImpl$LoaderInfo.onActive(LoaderManagerImpl.java:73)
at android.arch.lifecycle.LiveData$ObserverWrapper.activeStateChanged(LiveData.java:410)
at android.arch.lifecycle.LiveData$LifecycleBoundObserver.onStateChanged(LiveData.java:368)
at android.arch.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
at android.arch.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:292)
at android.arch.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:332)
at android.arch.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:137)
at android.arch.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:123)
at android.arch.lifecycle.ReportFragment.dispatch(ReportFragment.java:121)
at android.arch.lifecycle.ReportFragment.onStart(ReportFragment.java:81)
at android.app.Fragment.performStart(Fragment.java:2378)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1027)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1171)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1153)
at android.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:2046)
at android.app.FragmentController.dispatchStart(FragmentController.java:187)
at android.app.Activity.performStart(Activity.java:6879)
at android.app.Activity.performRestart(Activity.java:6947)
at android.app.Activity.performResume(Activity.java:6952)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3470)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3533)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6342)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
java.lang.RuntimeException: Unable to resume activity {com.yoreach.residentapp/com.lzy.imagepicker.ui.ImageGridActivity}: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3493) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3533) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:163) at android.app.ActivityThread.main(ActivityThread.java:6342) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770) Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.get(ArrayList.java:411) at com.lzy.imagepicker.ImageDataSource.onLoadFinished(ImageDataSource.java:130) at com.lzy.imagepicker.ImageDataSource.onLoadFinished(ImageDataSource.java:27) at android.support.v4.app.LoaderManagerImpl$LoaderObserver.onChanged(LoaderManagerImpl.java:221) at android.arch.lifecycle.LiveData.considerNotify(LiveData.java:109) at android.arch.lifecycle.LiveData.dispatchingValue(LiveData.java:126) at android.arch.lifecycle.LiveData.setValue(LiveData.java:282) at android.arch.lifecycle.MutableLiveData.setValue(MutableLiveData.java:33) at android.support.v4.app.LoaderManagerImpl$LoaderInfo.onLoadComplete(LoaderManagerImpl.java:156) at android.support.v4.content.Loader.deliverResult(Loader.java:130) at android.support.v4.content.CursorLoader.deliverResult(CursorLoader.java:107) at android.support.v4.content.CursorLoader.onStartLoading(CursorLoader.java:153) at android.support.v4.content.Loader.startLoading(Loader.java:283) at android.support.v4.app.LoaderManagerImpl$LoaderInfo.onActive(LoaderManagerImpl.java:73) at android.arch.lifecycle.LiveData$ObserverWrapper.activeStateChanged(LiveData.java:410) at android.arch.lifecycle.LiveData$LifecycleBoundObserver.onStateChanged(LiveData.java:368) at android.arch.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354) at android.arch.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:292) at android.arch.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:332) at android.arch.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:137) at android.arch.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:123) at android.arch.lifecycle.ReportFragment.dispatch(ReportFragment.java:121) at android.arch.lifecycle.ReportFragment.onStart(ReportFragment.java:81) at android.app.Fragment.performStart(Fragment.java:2378) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1027) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1171) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1153) at android.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:2046) at android.app.FragmentController.dispatchStart(FragmentController.java:187) at android.app.Activity.performStart(Activity.java:6879) at android.app.Activity.performRestart(Activity.java:6947) at android.app.Activity.performResume(Activity.java:6952) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3470) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3533) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:163) at android.app.ActivityThread.main(ActivityThread.java:6342) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)