I have a fragment with parent RecyclerView and his child (the child is inner recyclerview). When I scroll to bottom (last data), and scroll it again to top, I found the problem. One of data is missing. When I try to scroll to bottom again and scroll to top, the data is random. Anyone can help me?
HomeFragment
GridLayoutManager gl = new GridLayoutManager(getContext(), 1,
GridLayoutManager.VERTICAL, false);
ParentAdapter adapter = new ParentAdapter(getContext(), parentList);
rcvParent.setAdapter(adapter);
OnBindViewHolder
holder.title.setText(parentList.get(position).getTitle());
if (parentList.get(position).getProducts() != null) {
for (ProductModel pm : parentList.get(position).getProducts()) {
productList.add(pm);
}
GridLayoutManager childLayout = new GridLayoutManager(mContext, 1, GridLayoutManager.HORIZONTAL, false);
holder.childRecyclerView.setLayoutManager(childLayout);
ChildAdapter ca = new ChildAdapter(mContext, productList);
holder.childRecyclerView.setAdapter(ca);
} else {
holder.childRecyclerView.setVisibility(View.GONE);
}
ScreenShoot