android - RecyclerView and IndexOutOfBoundsException: Invalid index #, size is # -


i have simple recyclerview , want remove items onclick. continuously running crash depending on when clicked on items in list above error. if you're having similar issues, here's how solved it:

public void onbindviewholder(final cardviewholder holder, final int position) 

using position here useful things, if used when removing items list, causing crash, instead using:

holder.getadapterposition(); 

resolved issues immediately.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -