My app has three fragments inside main activity, just like whatsapp.
This is the intent I use to go from one of the fragments to a new activity "A".
Intent intent = new Intent(context, GroupChatActivity.class);
intent.putExtra("currentGroup", key);
context.startActivity(intent);
From "A", it goes to another new activity, "B".
I got the below ERROR when I pressed back button inside activity, "A".
java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{4758b98 position=15 id=-1, oldPos=0, pLpos:0 scrap [attachedScrap] tmpDetached no parent} androidx.recyclerview.widget.RecyclerView{d5047bd VFED..... .......D 10,246-710,1454 #7f08018c app:id/recyclerChatView}, adapter:com.example.vote.QuestionModelAdapter@87172c0, layout:androidx.recyclerview.widget.LinearLayoutManager@9c48bf9, context:com.example.vote.GroupChatActivity@7c06ca2
I have solved that error by calling finish(), overiding onBackPressed function. But I got the same error when I pressed back button inside activity "B". It is supposed to open the previous activity "A". (By the way, activity A has a recycle view.)
Calling finish() isn't working in here. Can you explain the above error and when it causes? And what happened to the current activity when you call startActivity(intent)? I think something happened to activity "A" when intent is called.