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
Android RecyclerView IllegalArgumentException: called detach on an already detached child ViewHolder #4
Comments
Hi, can you please copy and past the code snippet(s) in which you instantiate the adapter, add the sub-adapters to the adapter and where you possibly notify the adapter of data changes? This would be a tremendous help. |
Hi Ronaldw Thank you for response I have simplified my code and changed it a bit, changed function and variable names and logic to a bit but code looks like this
And function call
|
Hi, @guruduttstay. The reason I am asking is because I have seen this problem occur before in my own project when I was not using the correct Furthermore, I would recommend using Meanwhile, we have just merged a Pull Request that has quite drastically overhauled the source code for the adapter. If you'd be willing to try out this code it would be a tremendous help. I have been using the adapter in this way in my own project for a very long time and it works fantastically. Hope you'll fix the crash. |
Hi @ronaldw Thank you for your help.
Sure I will try this JFYI : I fond this crash more often on appcompat-v7:23.4.0 and heigher version I have seen this issue only 2 times with appcompat-v7:23.0.1 .... not sure if that is something you want to look into I will try your suggestion and get back to you asap let me know how can I try your merged branch Thank you |
The changes have been merged to |
Just now we have published version 2.0.0 on bintray. Use:
If you find any issues with the adapter, please file another issue. I'd be happy to help you solve any bugs if you come across them. |
Finally, if you are curious about how to properly use the adapter and the |
I am still getting this issue :( |
Hi I have updated my code with updated RecyclerViewMergeAdapter (2.x) but with appCompat 23.4.0 and higher versions still it I get this issue more often
|
Hi @guruduttstay . Sorry that these problems keep bothering you. The RecyclerView is a rather complex component so it is not easy for me to say what is causing the exception immediately. However, I did notice in your code that you call Also, when you call |
Hi again, To the best of my efforts I have tried to change your code to have it include the correct
I have modified your |
Thank you @ronaldw for your great help :) Finally we figure it out and fixed it. I am using viewPager and in next fragment I had this code where it was adding same view twice ...
It added same view twice to mergeAdapter and ...... :( |
I meet the same Issue, but it does not solve my problem.Is there any answer? |
I am getting following error sometime (not every time) while updating recycler adapter.
Note : I am using RecyclerViewMergeAdapter
What I am doing here is :
I have created 3 different type adapter and based on need it is trying to merge 9 adapter in a loop and all these 9 adapter can of of one of the 3 types we have.
All adapters are merged to RecyclerViewMergeAdapter but at some point it is crashing
Also Notice : IF all my sub adapter contains 3 or less items then it works fine but if my sub adapters contains more than 3 to 20 items then it crashes.
Please let me know if someone of have seen this issue and found any solution to this.
The text was updated successfully, but these errors were encountered: