Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refreshing gives IndexOutOfBoundsException #13

Open
jakepurple13 opened this issue Dec 3, 2018 · 4 comments
Open

Refreshing gives IndexOutOfBoundsException #13

jakepurple13 opened this issue Dec 3, 2018 · 4 comments

Comments

@jakepurple13
Copy link

BUG

What is the current behavior?
When I refresh my recyclerview and then try to swipe to dismiss an item, I get an IndexOutOfBoundsException.
If the current behavior is a bug, please provide the steps to reproduce.

I just to a refresh and then try to swipe to dismiss an item.

Any logs, error output, bugreport etc?

adapter = RVHAdapter(context, listOfFiles)
recyclerView.swapAdapter(adapter, true)
val callback = RVHItemTouchHelperCallback(adapter, false, true, true)
val helper = ItemTouchHelper(callback)
helper.attachToRecyclerView(recyclerView)

What is the expected behavior?
No IndexOutOfBoundsException
Any other comments?

What versions of software are you using?

  • Device Information:
    Google Pixel 2

  • Android Version:
    Android 9: Pie

  • Configuration Information:

  • Misc:
    Logcat:
    java.lang.IndexOutOfBoundsException: Index: 4, Size: 0
    at java.util.ArrayList.get(ArrayList.java:437)
    at com.example.ViewVideosActivity$VideoAdapter$onItemDismiss$1.invoke(ViewVideosActivity.kt:295)
    at com.example.ViewVideosActivity$VideoAdapter$onItemDismiss$1.invoke(ViewVideosActivity.kt:260)
    at org.jetbrains.anko.AsyncKt.runOnUiThread(Async.kt:34)
    at com.example.ViewVideosActivity$VideoAdapter.onItemDismiss(ViewVideosActivity.kt:291)

@nisrulz
Copy link
Owner

nisrulz commented Dec 3, 2018

Will take a look and try to reproduce this. @jakepurple13 Do you already have this on GitHub or is it private? If it is an opensource app, I can use that to replicate this issue much easier.

@nisrulz
Copy link
Owner

nisrulz commented Dec 4, 2018

Made a new release yesterday and migrated to AndroidX. If you are already using AndroidX in your project, then give the new release a try.

If not using AndroidX then I would need to look into this.

@jakepurple13
Copy link
Author

I'm not using AndroidX. I have a swipe to refresh method and after I refresh, that's when I get errors.
in onItemDismiss, the data list becomes empty. That's what I found. I also looked into the library that you had said this was kind of based off of, @iPaulPro's ItemTouchHelper, and I was getting the same error.

@nisrulz
Copy link
Owner

nisrulz commented Dec 4, 2018

Interesting, then I will take a look at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants